[wxPython-users] ANN: wxpsvg, SVG rendering for wxPython
Chris Mellon
arkanes at gmail.com
Mon Jul 2 18:10:10 PDT 2007
On 7/2/07, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> Chris,
>
> Pretty cool!
>
> I haven't looked at the code yet, but I'm hoping that you haven't
> married the parser and renderer too much. I really believe in separating
> functionality (call it MVC or whatever).
>
There's not really that much to seperate. The SVG document is
compiled into a list of drawing operations. Rendering the SVG is just
a matter of iterating over the list and executing each operation.
> If nothing else, it would be nice to edit a drawing directly, rather
> than having to generate SVG, then render it.
>
It's not related to SVG per se, but theres a utility in there called
drawer.py that lets you add operations to a wxGraphicsPath and updates
a canvas in real time. I wrote it as a way of testing wxGC
functionality but it might make a basis for a wxGC based drawing tool.
> I'm also wondering about the scaling part of SVG. Have you taken a look
> at wx.lib.FloatCanvas? I designed it before GraphicsContext, so it's
> totally DC based, but I'm hoping to update it to use Graphics context
> some day. In any case, it's designed to be the a widget for Viewing,
> well, scalable vector graphics, so it would be nice to tie it to SVG
> some day. Maybe you can get some ideas about how to handle zooming,
> scrolling, hit testing, etc from it.
>
Zooming and hittesting are extremly easy with wxGraphicsContext. You
just push a scale factor for zoom, and you can get a hitbox from a
path that makes hittesting trivial. Scrolling is pretty much the same
as anything else.
a wxGC based floatcanvas would be spectacular, feel free to take any
code you want.
> If nothing else, it looks like you've got a great way to define features
> that wx.GraphicsContext needs.
>
Theres quite a bit of functionality that needs to be added to the wxGC
api in order to be able to fully render SVG. Some of it's trivial,
some will be hard or even impossible.
> Keep up the good work!
>
Thanks ;)
More information about the wxpython-users
mailing list