AGG-based drawing for PIL

Yes, almost exactly the same way he uses the Tkinter example.
wx.Window.GetHandle() will return the HWND aggdraw wants.

···

On 10/23/05, Chris Barker <Chris.Barker@noaa.gov> wrote:

Hi all,

This from the Image-SIG. He's given a Tk example, could this be done
efficiently with wxPython? Agg is a really nice rendering library.

-Chris

From: Fredrik Lundh <fredrik@pythonware.com>

> 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.

--
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Chris Mellon wrote:

Yes, almost exactly the same way he uses the Tkinter example.
wx.Window.GetHandle() will return the HWND aggdraw wants.

Will that only work on wxMSW?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                          
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov