Wednesday, September 28, 2005

The aggdraw Module

An AGG-based drawing interface.


The aggdraw module implements the basic WCK 2D Drawing Interface on top of the AGG library. This library supports anti-aliasing and alpha compositing, but is otherwise fully compatible with the WCK renderer.


Examples:


# draw cross on top of PIL image

d = aggdraw.Draw(im)
p = aggdraw.Pen("black", 0.5)
d.line((0, 0, 500, 500), p)
d.line((0, 500, 500, 0), p)
d.flush()

# draw cross on internal image memory
d = aggdraw.Draw("RGB", (320, 200), "white")
p = aggdraw.Pen("black", 0.5)
d.line((0, 0, 500, 500), p)
d.line((0, 500, 500, 0), p)
s = d.tostring()