wxpalettea 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). see wximage for more information. derived from include files <wx/palette.h> predefined objects objects: wxnullpalette see also members
wxpalette::wxpalette
wxpalette::wxpalettewxpalette() default constructor. wxpalette(const wxpalette& palette) copy constructor, uses reference counting.
wxpalette(int n, const unsigned char* red, creates a palette from arrays of size n, one for each red, blue or green component. parameters palette
n
red
green
blue
see also wxperl note: in wxperl the third constructor form takes as parameters 3 array references ( they must be of the same length ).
wxpalette::~wxpalette~wxpalette() destructor. see reference-counted object destruction for more info.
wxpalette::createbool create(int n, const unsigned char* red, const unsigned char* green, const unsigned char* blue) creates a palette from arrays of size n, one for each red, blue or green component. parameters n
red
green
blue
return value true if the creation was successful, false otherwise. see also
wxpalette::getcolourscountint getcolourscount() const returns number of entries in palette.
wxpalette::getpixelint getpixel(unsigned char red, unsigned char green, unsigned char blue) const returns a pixel value (index into the palette) for the given rgb values. parameters red
green
blue
return value the nearest palette index or wxnot_found for unexpected errors. see also
wxpalette::getrgbbool getrgb(int pixel, const unsigned char* red, const unsigned char* green, const unsigned char* blue) const returns rgb values for a given palette index. parameters pixel
red
green
blue
return value true if the operation was successful. see also wxperl note: in wxperl this method takes only the pixel parameter and returns a 3-element list ( or the empty list upon failure ).
wxpalette::isokbool isok() const returns true if palette data is present.
wxpalette::operator =wxpalette& operator =(const wxpalette& palette) assignment operator, using reference counting.
|