[Image-SIG] AGG-based drawing for PIL

Fredrik Lundh fredrik at pythonware.com
Sat Oct 22 15:39:35 CEST 2005


continuing the tradition of announcing new releases by replying
to myself:

> the "aggdraw" module is a prerelease of a new drawing library for PIL,
> based on Maxim Shemanarev's antigrain (AGG) graphics library.  This
> module implements a WCK-style drawing interface (see below), and
> provides anti-aliasing and alpha compositing.

A very early 1.2 alpha is now available.

You can now create "drawable Windows DIB surfaces", and blit them
to screen under any Windows-based toolkit that lets you access the
HWND for a toolkit window.

    draw = aggdraw.Dib("RGB", (width, height))
    ... draw as usual ...
    draw.expose(hwnd) # blit to screen

Here's a Tkinter example:

    size = width, height

    draw = aggdraw.Dib("RGB", size)
    ... draw as usual ...

    # display the image
    frame = Frame(width=size[0], height=size[1], bg="")
    frame.bind("<Expose>", lambda e: draw.expose(e.widget.winfo_id()))
    frame.pack()

A source kit can be found here:

    http://effbot.org/downloads/#aggdraw

To display aggdraw images under Tkinter on other platforms, you can use
PIL's ImageTk.PhotoImage object, or the WCK toolkit.  See

    http://effbot.org/zone/wck-aggview.htm

for an example on how to use the latter.

</F>





More information about the Image-SIG mailing list