|
From: Kevin A. <al...@se...> - 2001-09-16 06:07:54
|
I added two additional methods to the Bitmap class. The following shell
fragment using the doodle sample shows getting a PIL format RGB image from a
Bitmap and then setting the Bitmap with a PIL image. In both cases, the
transparency is still a problem, which probably has to do with my internal
conversion from GIF to RGB, but I haven't figured out how to properly
convert to and from RGBA or whatever format I should be using. Any PIL
experts in the house?
>>> import PythonCardPrototype
>>> bmp = PythonCardPrototype.widget.Bitmap('trash.gif')
>>> pil = bmp.getPILBits()
>>> comp.bufOff.drawBitmap(bmp, 10, 10)
>>> comp.bufOff.drawPIL(pil, 10, 50)
>>> bmp.setPILBits(pil)
>>> comp.bufOff.drawBitmap(bmp, 50, 10)
The Bitmap class is used by the Image, ImageButton and BitmapCanvas
widgets. Note that the Image class causes a name conflict with the Image
module of PIL, so I had to add an additional import to widget.py to get
around it.
ka
|