|
From: Kevin A. <al...@se...> - 2001-09-13 23:35:33
|
I renamed the BitmapDrawing widget to BitmapCanvas. I also changed the
current methods to be more efficient when autoRefresh is 0 (false). Finally,
I added a drawBitmap method which accepts a Bitmap object, x, y location,
and whether to draw the image transparently if the bitmap has a transparency
mask.
I copied the trash.gif image from the proof sample into the doodle directory
to show this method in action from the shell.
>>> import PythonCardPrototype
>>> bmp = PythonCardPrototype.widget.Bitmap('trash.gif')
>>> comp.bufOff.drawBitmap(bmp, 50, 50)
Since our own Bitmap wrapper class is used, which is normally initialized
with a filename (a filename of '' gives you an empty bitmap), some extra
work is necessary if you wanted to use say an image created with the Python
Imaging Library (PIL). The Bitmap class has a setBits() method that accepts
a wxBitmap as input and that is what you would use to get a bitmap or image
created with another library into a PythonCard Bitmap.
See the wxPython Wiki
http://wxpython.org/cgi-bin/wiki/WorkingWithImages
for some more ideas.
At some point, we should write a more comprehensive set of wrapper and
conversion routines to simplify moving between PythonCard bitmaps and other
formats. Jeff Griffith mentioned several weeks ago that he was going to work
on icon packs
http://aspn.activestate.com/ASPN/Mail/Message/PythonCard/762295
Jeff, how is this progressing?
Anyone interested in image processing, scientific and business graphing,
game programming, etc. that would like to work on this part of the framework
should speak up. I've talked to Pete Shinners, the PyGame author and there
are definitely ways the two frameworks can work together and we can probably
share some PyGame code as part of PythonCard as well.
ka
|