[wxPython-users] GCDC vs DC

Chris Mellon arkanes at gmail.com
Thu Aug 2 10:23:41 PDT 2007


On 8/2/07, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> Christian K wrote:
> > What kind of optimization can be done when using GCDC instead of DC? Do you
> > think wx.lib.plot could be made faster, too?
>
> Probably not. Chris (another one) alluded to this, but I'll try to make
> it more clear.
>
> I'd love to be proved wrong, but in general, it appears that
> wx.GraphicsContext is slower than wx.DC. It's certainly true that GCDC
> is slower.
>
> The optimizations that were referred to was using the raw
> GraphicsContext, rather than GCDC. I don't know that it will ever get
> faster than a native DC but GraphicsContext can give much nicer results
> (and alpha blending, which is very nice)
>
> There would be a lot to be gained by porting pyplot to GraphicsContext,
> but speed is probably not it.
>
> -CHB
>

Drawing using wxGC can be very very fast when you leverage the ability
to re-use paths with  the transforms that wxGC exposes because it lets
you move the math out of python and into the heavily optimized native
implementation. It does, however, require a very different drawing
model. As the underlying platforms move more toward native vector
everything you might even end up with a gain - Gtk in the future is
likely to use cairo for all it's drawing, and raster operations will
be piped through it. Sort of the reverse of the current wxGCDC
penalty.




More information about the wxpython-users mailing list