1 from PIL import Image, ImageDraw
6 def draw_wu_line(draw, x, y, w, h):
7 # Without loss of generality only lines in the first oc
8 assert(w > 0 and h > 0 and w > h)
14 draw.point([(x, y), (x1, y1)], fill=(0, 0, 0, 0xff - (d >> 8)))
15 draw.point([(x, y + 1), (x1, y1 - 1)], fill=(0, 0, 0, d >> 8))
29 points = [(x, y), (x, y1)]
31 draw.point(points, fill=(0, 0, 0, alpha))
34 im = Image.new('RGBA', size)
35 d = ImageDraw.Draw(im, 'RGBA')
37 draw_wu_line(d, 0, 0, *size)
39 ##for w in range(51, 100):
40 ## draw_wu_line(d, 0, 0, w, 50)
42 base = Image.new('RGBA', size, (0xff, 0xff, 0xff, 0xff))
43 base.alpha_composite(im)
44 base.save('wu_demo.png')