Package wx :: Class Image
[frames | no frames]

Type Image

object --+    
         |    
    Object --+
             |
            Image


Proxy of C++ Image class
Method Summary
Image __init__(self, name, type, index)
  __del__(self)
  __nonzero__(self)
  __repr__(self)
  AddHandler(handler)
(Static method)
bool CanRead(name)
(Static method)
bool CanReadStream(stream)
(Static method)
unsigned long ComputeHistogram(self, h)
bool ConvertAlphaToMask(self, threshold)
If the image has alpha channel, this method converts it to mask.
  ConvertColourToAlpha(*args, **kwargs)
ConvertColourToAlpha(self, unsigned char r, unsigned char g, unsigned char b) -> bool
Bitmap ConvertToBitmap(self, depth)
  ConvertToMono(*args, **kwargs)
ConvertToMono(self, unsigned char r, unsigned char g, unsigned char b) -> Image
  ConvertToMonoBitmap(*args, **kwargs)
ConvertToMonoBitmap(self, unsigned char red, unsigned char green, unsigned char blue) -> Bitmap
Image Copy(self)
  CountColours(*args, **kwargs)
CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long
  Create(self, width, height)
  Destroy(self)
Deletes the C++ object this Python object is a proxy for.
(success, r, g, b) FindFirstUnusedColour(startR, startG, startB)
Find first colour that is not used in the image and has higher RGB values than startR, startG, startB.
unsigned char GetAlpha(self, x, y)
PyObject GetAlphaBuffer(self)
PyObject GetAlphaData(self)
Returns a string containing a copy of the alpha bytes of the image.
unsigned char GetBlue(self, x, y)
PyObject GetData(self)
Returns a string containing a copy of the RGB bytes of the image.
PyObject GetDataBuffer(self)
Returns a writable Python buffer object that is pointing at the RGB image data buffer inside the wx.Image.
unsigned char GetGreen(self, x, y)
int GetHeight(self)
int GetImageCount(name, type)
(Static method)
String GetImageExtWildcard()
(Static method)
unsigned char GetMaskBlue(self)
unsigned char GetMaskGreen(self)
unsigned char GetMaskRed(self)
String GetOption(self, name)
int GetOptionInt(self, name)
(r,g,b) GetOrFindMaskColour()
Get the current mask colour or find a suitable colour.
unsigned char GetRed(self, x, y)
Size GetSize(self)
Image GetSubImage(self, rect)
int GetWidth(self)
bool HasAlpha(self)
bool HasMask(self)
bool HasOption(self, name)
  InitAlpha(self)
Initializes the image alpha channel data.
  InsertHandler(handler)
(Static method)
  IsTransparent(*args, **kwargs)
IsTransparent(self, int x, int y, unsigned char threshold=IMAGE_ALPHA_THRESHOLD) -> bool
bool LoadFile(self, name, type, index)
bool LoadMimeFile(self, name, mimetype, index)
bool LoadMimeStream(self, stream, mimetype, index)
bool LoadStream(self, stream, type, index)
Image Mirror(self, horizontally)
bool Ok(self)
  Paste(self, image, x, y)
bool RemoveHandler(name)
(Static method)
  Replace(*args, **kwargs)
unsigned char r2, unsigned char g2, unsigned char b2)
Image Rescale(self, width, height)
Image Resize(self, size, pos, r, g, b)
Image Rotate(self, angle, centre_of_rotation, interpolating, offset_after_rotation)
Image Rotate90(self, clockwise)
bool SaveFile(self, name, type)
bool SaveMimeFile(self, name, mimetype)
Image Scale(self, width, height)
  SetAlpha(*args, **kwargs)
SetAlpha(self, int x, int y, unsigned char alpha)
  SetAlphaBuffer(self, alpha)
  SetAlphaData(self, alpha)
Resets the Image's alpha data from a buffer of bytes.
  SetData(self, data)
Resets the Image's RGB data from a buffer of RGB bytes.
  SetDataBuffer(self, data)
Sets the internal image data pointer to point at a Python buffer object.
  SetMask(self, mask)
  SetMaskColour(*args, **kwargs)
SetMaskColour(self, unsigned char r, unsigned char g, unsigned char b)
bool SetMaskFromImage(self, mask, mr, mg, mb)
  SetOption(self, name, value)
  SetOptionInt(self, name, value)
  SetRGB(*args, **kwargs)
SetRGB(self, int x, int y, unsigned char r, unsigned char g, unsigned char b)
  SetRGBRect(*args, **kwargs)
SetRGBRect(self, Rect rect, unsigned char r, unsigned char g, unsigned char b)
Image ShrinkBy(self, xFactor, yFactor)
Image Size(self, size, pos, r, g, b)

Instance Method Details

ConvertAlphaToMask(self, threshold=IMAGE_ALPHA_THRESHOLD)

If the image has alpha channel, this method converts it to mask. All pixels with alpha value less than threshold are replaced with mask colour and the alpha channel is removed. Mask colour is chosen automatically using FindFirstUnusedColour.

If the image image doesn't have alpha channel, ConvertAlphaToMask does nothing.

Parameters:
threshold
           (type=byte)
Returns:
bool

ConvertColourToAlpha(*args, **kwargs)

ConvertColourToAlpha(self, unsigned char r, unsigned char g, unsigned char b) -> bool

This method converts an image where the original alpha information is only available as a shades of a colour (actually shades of grey) typically when you draw anti-aliased text into a bitmap. The DC drawing routines draw grey values on the black background although they actually mean to draw white with differnt alpha values. This method reverses it, assuming a black (!) background and white text. The method will then fill up the whole image with the colour given.

ConvertToMono(*args, **kwargs)

ConvertToMono(self, unsigned char r, unsigned char g, unsigned char b) -> Image

ConvertToMonoBitmap(*args, **kwargs)

ConvertToMonoBitmap(self, unsigned char red, unsigned char green, unsigned char blue) -> Bitmap

CountColours(*args, **kwargs)

CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long

Destroy(self)

Deletes the C++ object this Python object is a proxy for.
Overrides:
wx.Object.Destroy

FindFirstUnusedColour(startR=1, startG=0, startB=0)

Find first colour that is not used in the image and has higher RGB values than startR, startG, startB. Returns a tuple consisting of a success flag and rgb values.
Parameters:
startR
           (type=int)
startG
           (type=int)
startB
           (type=int)
Returns:
(success, r, g, b)

GetAlphaData(self)

Returns a string containing a copy of the alpha bytes of the image.
Returns:
PyObject

GetData(self)

Returns a string containing a copy of the RGB bytes of the image.
Returns:
PyObject

GetDataBuffer(self)

Returns a writable Python buffer object that is pointing at the RGB image data buffer inside the wx.Image.
Returns:
PyObject

GetOrFindMaskColour()

Get the current mask colour or find a suitable colour.
Returns:
(r,g,b)

InitAlpha(self)

Initializes the image alpha channel data. It is an error to call it if the image already has alpha data. If it doesn't, alpha data will be by default initialized to all pixels being fully opaque. But if the image has a a mask colour, all mask pixels will be completely transparent.

IsTransparent(*args, **kwargs)

IsTransparent(self, int x, int y, unsigned char threshold=IMAGE_ALPHA_THRESHOLD) -> bool

Returns True if this pixel is masked or has an alpha value less than the spcified threshold.

Replace(*args, **kwargs)

Replace(self, unsigned char r1, unsigned char g1, unsigned char b1,
unsigned char r2, unsigned char g2, unsigned char b2)

SetAlpha(*args, **kwargs)

SetAlpha(self, int x, int y, unsigned char alpha)

SetAlphaData(self, alpha)

Resets the Image's alpha data from a buffer of bytes. Accepts either a string or a buffer object holding the data and the length of the data must be width*height.
Parameters:
alpha
           (type=buffer)

SetData(self, data)

Resets the Image's RGB data from a buffer of RGB bytes. Accepts either a string or a buffer object holding the data and the length of the data must be width*height*3.
Parameters:
data
           (type=buffer)

SetDataBuffer(self, data)

Sets the internal image data pointer to point at a Python buffer object. This can save a copy of the data but you must ensure that the buffer object lives longer than the wx.Image does.
Parameters:
data
           (type=buffer)

SetMaskColour(*args, **kwargs)

SetMaskColour(self, unsigned char r, unsigned char g, unsigned char b)

SetRGB(*args, **kwargs)

SetRGB(self, int x, int y, unsigned char r, unsigned char g, unsigned char b)

SetRGBRect(*args, **kwargs)

SetRGBRect(self, Rect rect, unsigned char r, unsigned char g, unsigned char b)

Generated by Epydoc 2.1.20040428.rpd on Tue Apr 26 14:24:58 2005 http://epydoc.sf.net