Xiaolin Wu's line algorithm: Difference between revisions

Content added Content deleted
(self bugfix of bugfix)
Line 2,733: Line 2,733:
Use alpha for blending. alpha=1 means a completely opaque foreground.
Use alpha for blending. alpha=1 means a completely opaque foreground.
"""
"""
compose_color = lambda bg, fg: int(np.round(alpha * fg + (1-alpha) * bg))
compose_color = lambda bg, fg: int(round(alpha * fg + (1-alpha) * bg))
c = compose_color(img.getpixel(xy), color, alpha)
c = compose_color(img.getpixel(xy), color, alpha)
img.putpixel(xy, c)
img.putpixel(xy, c)