[Chandler-dev] Making custom gradient brush is slow

Robin Dunn robin at alldunn.com
Tue Apr 10 10:27:48 PDT 2007

Jeffrey Harris wrote:
>> Could some of those approaches be used instead of our custom gradients?
> I'm pretty sure Alec tried those when he was experimenting with
> gradients, but unfortunately I don't know why he didn't choose them.
> I'll ask him.  Of course, it's always possible wx has improved since
> Alec last played with gradients, so it may be worth experimenting again.

The GraphicsContext classes is new since Alec left, but if you're not 
drawing the rest of the calendar using it then it won't be much help.

The wxDC gradient functions are newish as well, but the radial gradient 
doesn't work on wxGTK.

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.

Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!

More information about the chandler-dev mailing list