|
From: Kevin A. <al...@se...> - 2001-10-10 17:36:34
|
The Bitmap class in graphic.py now has loadFile and saveFile methods. I also
added file type support for some formats I had overlooked earlier.
Supported extensions/formats:
BMP, GIF, JPG/JPEG, PCX, PNG, PNM, TIF/TIFF, XBM, and XPM.
You can specify an empty filename ('') for loadFile if you just want to
create an empty Bitmap; you should specify a size when creating an empty
bitmap. Empty bitmaps via the Image class, are used in the
SourceForgeTracker example to provide colored rectangles behind widgets. If
a filename is not specified for saveFile, then the filename that was used to
initialize the Bitmap will be used instead.
You can't save in GIF format due to licensing restrictions. XBM format
didn't work for me under Windows, but I have a question into Robin to make
sure it isn't a bug. You can't always trust the wxWindows documentation on
these issues.
There is currently no way to specify the bitmap depth, palette, or do any
image manipulation such as scaling and rotation or even get information such
as the color value of a given pixel. Internally, the Bitmap class uses a
wxBitmap. wxPython uses a separate image class wxImage for image
manipulation. We could wrap up some or all of the image manipuation routines
inside Bitmap and then hide the necessary conversion to/from wxImage. If
we're not worried about memory usage, we could keep a duplicate of the
wxBitmap as a wxImage to reduce the delay for some routines. Other
suggestions?
Remember that last month I added the getPILBits and setPILBits methods, so
you can always do image manipulation with PIL if you want.
Initially, the Bitmap class was created for the use of the Image and
ImageButton classes and it was geared towards always loading a bitmap from a
file. Given that the Bitmap class is now being used for images that don't
come from a file the design may need to be tweaked to be more flexible, yet
still simple to use. Please respond to the list with suggestions for what
you want to see in the Bitmap class.
ka
|