[Chandler-dev] Making custom gradient brush is slow
heikki at osafoundation.org
Tue Apr 10 17:34:39 PDT 2007
Robin Dunn wrote:
> Something else that is new that may help is we now have the ability to
> get raw access to a wx.Bitmap's internal buffer. You can either use an
> iterator interface to access the RGB(A) data, or there are some
> convenience functions to create a wx.Bitmap from a buffer of RGB(A)
> data, where the buffer can be anything that supports the Python buffer
> interface, such as a string, array.array, or even a numpy array. The
> latter can allow repeating patterns like gradients to be built fairly
> fast. See the RawBitmapAccess sample in the wxPython demo for examples.
I looked at those, but it seems like the most expensive thing in
MakeGradientBrush are the color value calculations for each pixel.
Still, I tested by using the wx samples, and I could not make the method
any faster than it is (only slightly slower) - even though my code was
not creating intermediate image or bitmap objects.
Like I said, this method takes about 8% in the resize case. 3% each goes
to the vector multiply and addition operations. So the whole
MakeGradientBrush should move into C to make this faster, I think - or
in other words, if we could use some of the higher level wx gradient
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.osafoundation.org/pipermail/chandler-dev/attachments/20070410/4a6fa14f/signature.pgp
More information about the chandler-dev