]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/palette.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPalette
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 A palette is a table that maps pixel values to RGB colours. It allows the
13 colours of a low-depth bitmap, for example, to be mapped to the available
14 colours in a display. The notion of palettes is becoming more and more
15 obsolete nowadays and only the MSW port is still using a native palette.
16 All other ports use generic code which is basically just an array of
19 It is likely that in the future the only use for palettes within wxWidgets
20 will be for representing colour indeces from images (such as GIF or PNG).
21 The image handlers for these formats have been modified to create a palette
22 if there is such information in the original image file (usually 256 or less
23 colour images). See wxImage for more information.
31 @see wxDC::SetPalette(), wxBitmap
33 class wxPalette
: public wxGDIObject
43 Copy constructor, uses @ref overview_refcount.
45 wxPalette(const wxPalette
& palette
);
48 Creates a palette from arrays of size @a n, one for each red, blue or
52 A pointer or reference to the palette to copy.
54 The number of indices in the palette.
56 An array of red values.
58 An array of green values.
60 An array of blue values.
64 wxPalette(int n
, const unsigned char* red
,
65 const unsigned char* green
,
66 const unsigned char* blue
);
71 @see @ref overview_refcount_destruct "reference-counted object destruction"
76 Creates a palette from arrays of size @a n, one for each red, blue or
80 The number of indices in the palette.
82 An array of red values.
84 An array of green values.
86 An array of blue values.
88 @return @true if the creation was successful, @false otherwise.
92 bool Create(int n
, const unsigned char* red
,
93 const unsigned char* green
,
94 const unsigned char* blue
);
97 Returns number of entries in palette.
99 virtual int GetColoursCount() const;
102 Returns a pixel value (index into the palette) for the given RGB values.
111 @return The nearest palette index or @c wxNOT_FOUND for unexpected errors.
115 int GetPixel(unsigned char red
, unsigned char green
,
116 unsigned char blue
) const;
119 Returns RGB values for a given palette index.
124 Receives the red value.
126 Receives the green value.
128 Receives the blue value.
130 @return @true if the operation was successful.
134 bool GetRGB(int pixel
, const unsigned char* red
,
135 const unsigned char* green
,
136 const unsigned char* blue
) const;
139 Returns @true if palette data is present.
144 Assignment operator, using @ref overview_refcount.
146 wxPalette
& operator =(const wxPalette
& palette
);
153 wxPalette wxNullPalette
;