********** wx.Palette ********** Inheritance diagram for `wx.Palette`: | .. inheritance-diagram:: wx.Palette | Description =========== A palette is a table that maps pixel values to RGB colours. It allows the colours of a low-depth bitmap, for example, to be mapped to the available colours in a display. The notion of palettes is becoming more and more obsolete nowadays and only the MSW port is still using a native palette. All other ports use generic code which is basically just an array of colours. It is likely that in the future the only use for palettes within wxWidgets will be for representing colour indeces from images (such as GIF or PNG). The image handlers for these formats have been modified to create a palette if there is such information in the original image file (usually 256 or less colour images). .. seealso:: `wx.DC.SetPalette `_, `wx.Bitmap `_, `wx.Image `_ Derived From ^^^^^^^^^^^^^ * `wx.GDIObject `_ * `wx.Object `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `GetColoursCount <#GetColoursCount>`_ * `GetPixel <#GetPixel>`_ * `GetRGB <#GetRGB>`_ * `IsOk <#IsOk>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `ColoursCount <#ColoursCount>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(red, green, blue) Creates a palette from arrays of size `n`, one for each red, blue or green component. **Parameters:** * `red` (array of integers) * `green` (array of integers) * `blue` (array of integers) | **Returns:** `wx.Palette `_ -------- .. method:: GetColoursCount() Returns number of entries in palette. | **Returns:** `int` -------- .. method:: GetPixel(red, green, blue) Returns a pixel value (index into the palette) for the given RGB values. **Parameters:** * `red` (int): Red value. * `green` (int): Green value. * `blue` (int): Blue value. | **Returns:** `int` .. seealso:: `GetRGB <#GetRGB>`_ -------- .. method:: GetRGB(pixel) Returns RGB values for a given palette index. **Parameters:** * `pixel` (int): The palette index. | **Returns:** `bool` .. seealso:: `GetPixel <#GetPixel>`_ -------- .. method:: IsOk() Returns ``True`` if palette data is present. | **Returns:** `bool` -------- Properties ^^^^^^^^^^ .. attribute:: ColoursCount See `GetColoursCount <#GetColoursCount>`_