Xiaolin Wu's line algorithm: Difference between revisions

Bugfix
(Bugfix)
Line 2,729:
 
def putpixel(img, xy, color, alpha=1):
"""
"""Paints color over the background at the point xy in img.
Use alpha for blending. alpha=1 means a completely opaque foreground.
 
"""
ccompose_color = tuple(map(lambda bg, fg: int(np.round(alpha * fg + (1-alpha) * bg)),
c = compose_color(img.getpixel(xy), color), alpha)
img.putpixel(xy, c)
 
Line 2,763 ⟶ 2,762:
return px
 
xstart = draw_endpoint(p(*p1)) + 1
xend = draw_endpoint(p(*p2))
 
for x in range(xstart, xend):
Anonymous user