Home | Trees | Index | Help |
|
---|
Package wx :: Class Bitmap |
|
object
--+ |Object
--+ |GDIObject
--+ | Bitmap
The wx.Bitmap class encapsulates the concept of a platform-dependent
bitmap. It can be either monochrome or colour, and either loaded from
a file or created dynamically. A bitmap can be selected into a memory
device context (instance of wx.MemoryDC
). This enables the bitmap to
be copied to a window or memory device context using wx.DC.Blit
, or
to be used as a drawing surface.
The BMP and XMP image file formats are supported on all platforms by
wx.Bitmap. Other formats are automatically loaded by wx.Image
and
converted to a wx.Bitmap, so any image file format supported by
wx.Image
can be used.
See Also:
wx.EmptyBitmap
, wx.BitmapFromIcon
, wx.BitmapFromImage
,
wx.BitmapFromXPMData
, wx.BitmapFromBits
, wx.BitmapFromBuffer
,
wx.BitmapFromBufferRGBA
, wx.BitmapFromBuffer32bit
, wx.Image
To Do:
Add wrappers and support for raw bitmap data access. Can this be be put into Python without losing the speed benefits of the teplates and iterators in rawbmp.h?
Find a way to do very efficient PIL Image <--> wx.Bitmap converstions.
Method Summary | |
---|---|
Bitmap |
|
__del__(self)
| |
bool | __eq__(self,
other)
|
bool | __ne__(self,
other)
|
__nonzero__(self)
| |
Image |
Creates a platform-independent image from a platform-dependent bitmap. |
Copy data from a buffer object to replace the bitmap pixel data. | |
Copy data from a RGBA buffer object to replace the bitmap pixel data. | |
bool | CopyFromIcon(self,
icon)
|
Copy pixel data to a buffer object. | |
int |
Gets the colour depth of the bitmap. |
int |
Gets the height of the bitmap in pixels. |
Mask |
Gets the associated mask (if any) which may have been loaded from a file or explpicitly set for the bitmap. |
Palette | GetPalette(self)
|
Size |
Get the size of the bitmap. |
Bitmap |
Returns a sub-bitmap of the current one as long as the rect belongs entirely to the bitmap. |
int |
Gets the width of the bitmap in pixels. |
bool | HasAlpha(self)
|
bool | IsOk(self)
|
bool |
Loads a bitmap from a file. |
bool | Ok(self)
|
bool |
Saves a bitmap in the named file. |
Set the depth property (does not affect the existing bitmap data). | |
Set the height property (does not affect the existing bitmap data). | |
Sets the mask for this bitmap. | |
Create a Mask based on a specified colour in the Bitmap. | |
Set the bitmap size (does not affect the existing bitmap data). | |
Set the width property (does not affect the existing bitmap data). | |
UseAlpha(self)
|
Property Summary | |
---|---|
Depth : See GetDepth and SetDepth | |
Height : See GetHeight and SetHeight | |
Mask : See GetMask and SetMask | |
Palette : See GetPalette | |
Size : See GetSize and SetSize | |
SubBitmap : See GetSubBitmap | |
thisown : The membership flag | |
Width : See GetWidth and SetWidth |
Method Details |
---|
__init__(self,
name,
type=BITMAP_TYPE_ANY)
|
ConvertToImage(self)Creates a platform-independent image from a platform-dependent bitmap. This preserves mask information so that bitmaps and images can be converted back and forth without loss in that respect.
|
CopyFromBuffer(self, data, format=BitmapBufferFormat_RGB, stride=-1)Copy data from a buffer object to replace the bitmap pixel data. Default format is plain RGB, but other formats are now supported as well. The following symbols are used to specify the format of the bytes in the buffer: ============================= ================================ wx.BitmapBufferFormat_RGB A simple sequence of RGB bytes wx.BitmapBufferFormat_RGBA A simple sequence of RGBA bytes wx.BitmapBufferFormat_ARGB32 A sequence of 32-bit values in native endian order, with alpha in the upper 8 bits, followed by red, green, and blue. wx.BitmapBufferFormat_RGB32 Same as above but the alpha byte is ignored. ============================= ================================
|
CopyFromBufferRGBA(self, buffer)Copy data from a RGBA buffer object to replace the bitmap pixel data. This method is now just a compatibility wrapper around CopyFrombuffer. |
CopyToBuffer(self, data, format=BitmapBufferFormat_RGB, stride=-1)Copy pixel data to a buffer object. See
|
GetDepth(self)Gets the colour depth of the bitmap. A value of 1 indicates a monochrome bitmap.
|
GetHeight(self)Gets the height of the bitmap in pixels.
|
GetMask(self)Gets the associated mask (if any) which may have been loaded from a file or explpicitly set for the bitmap. |
GetSize(self)Get the size of the bitmap.
|
GetSubBitmap(self, rect)Returns a sub-bitmap of the current one as long as the rect belongs entirely to the bitmap. This function preserves bit depth and mask information.
|
GetWidth(self)Gets the width of the bitmap in pixels.
|
LoadFile(self, name, type)Loads a bitmap from a file. See
|
SaveFile(self, name, type, palette=None)Saves a bitmap in the named file. See
|
SetDepth(self, depth)Set the depth property (does not affect the existing bitmap data).
|
SetHeight(self, height)Set the height property (does not affect the existing bitmap data).
|
SetMask(self, mask)Sets the mask for this bitmap. |
SetMaskColour(self, colour)Create a Mask based on a specified colour in the Bitmap.
|
SetSize(self, size)Set the bitmap size (does not affect the existing bitmap data).
|
SetWidth(self, width)Set the width property (does not affect the existing bitmap data).
|
Property Details |
---|
Depth |
Height |
Mask |
PaletteSee
|
Size |
SubBitmapSee
|
thisownThe membership flag |
Width |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:55:39 2009 | http://epydoc.sf.net |