]>
git.saurik.com Git - wxWidgets.git/blob - interface/palette.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPalette
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A palette is a table that maps pixel values to RGB colours. It allows the
14 colours of a low-depth bitmap, for example, to be mapped to the available
15 colours in a display. The notion of palettes is becoming more and more
16 obsolete nowadays and only the MSW port is still using a native palette.
17 All other ports use generic code which is basically just an array of
20 It is likely that in the future the only use for palettes within wxWidgets
21 will be for representing colour indeces from images (such as GIF or PNG).
22 The image handlers for these formats have been modified to create a palette
23 if there is such information in the original image file (usually 256 or less
24 colour images). See wxImage for more information.
32 @see wxDC::SetPalette(), wxBitmap
34 class wxPalette
: public wxGDIObject
44 Copy constructor, uses @ref overview_refcount.
46 wxPalette(const wxPalette
& palette
);
49 Creates a palette from arrays of size @a n, one for each red, blue or
53 A pointer or reference to the palette to copy.
55 The number of indices in the palette.
57 An array of red values.
59 An array of green values.
61 An array of blue values.
65 wxPalette(int n
, const unsigned char* red
,
66 const unsigned char* green
,
67 const unsigned char* blue
);
72 @see @ref overview_refcount_destruct "reference-counted object destruction"
77 Creates a palette from arrays of size @a n, one for each red, blue or
81 The number of indices in the palette.
83 An array of red values.
85 An array of green values.
87 An array of blue values.
89 @returns @true if the creation was successful, @false otherwise.
93 bool Create(int n
, const unsigned char* red
,
94 const unsigned char* green
,
95 const unsigned char* blue
);
98 Returns number of entries in palette.
100 int GetColoursCount() const;
103 Returns a pixel value (index into the palette) for the given RGB values.
112 @returns The nearest palette index or @c wxNOT_FOUND for unexpected errors.
116 int GetPixel(unsigned char red
, unsigned char green
,
117 unsigned char blue
) const;
120 Returns RGB values for a given palette index.
125 Receives the red value.
127 Receives the green value.
129 Receives the blue value.
131 @returns @true if the operation was successful.
135 bool GetRGB(int pixel
, const unsigned char* red
,
136 const unsigned char* green
,
137 const unsigned char* blue
) const;
140 Returns @true if palette data is present.
145 Assignment operator, using @ref overview_refcount.
147 wxPalette
& operator =(const wxPalette
& palette
);
154 wxPalette wxNullPalette
;