]> git.saurik.com Git - wxWidgets.git/blame - interface/palette.h
Fixed some function/define paramter names to match old docs.
[wxWidgets.git] / interface / palette.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: palette.h
e54c96f1 3// Purpose: interface of wxPalette
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxPalette
3db7c3b1 11 @ingroup group_class_gdi
23324ae1 12 @wxheader{palette.h}
7c913512 13
23324ae1
FM
14 A palette is a table that maps pixel values to RGB colours. It allows the
15 colours of a low-depth bitmap, for example, to be mapped to the available
16 colours in a display. The notion of palettes is becoming more and more
17 obsolete nowadays and only the MSW port is still using a native palette.
18 All other ports use generic code which is basically just an array of
7c913512
FM
19 colours.
20
23324ae1
FM
21 It is likely that in the future the only use for palettes within wxWidgets
22 will be for representing colour indeces from images (such as GIF or PNG).
23 The image handlers for these formats have been modified to create a palette
24 if there is such information in the original image file (usually 256 or less
25 colour images). See wxImage for more information.
7c913512 26
23324ae1
FM
27 @library{wxcore}
28 @category{gdi}
7c913512 29
23324ae1 30 @stdobjects
e54c96f1 31 ::Objects:, ::wxNullPalette,
7c913512 32
e54c96f1 33 @see wxDC::SetPalette, wxBitmap
23324ae1
FM
34*/
35class wxPalette : public wxGDIObject
36{
37public:
38 //@{
39 /**
40 Creates a palette from arrays of size @e n, one for each
41 red, blue or green component.
42
7c913512 43 @param palette
4cc4bfaf 44 A pointer or reference to the palette to copy.
7c913512 45 @param n
4cc4bfaf 46 The number of indices in the palette.
7c913512 47 @param red
4cc4bfaf 48 An array of red values.
7c913512 49 @param green
4cc4bfaf 50 An array of green values.
7c913512 51 @param blue
4cc4bfaf 52 An array of blue values.
23324ae1 53
4cc4bfaf 54 @see Create()
23324ae1
FM
55 */
56 wxPalette();
7c913512
FM
57 wxPalette(const wxPalette& palette);
58 wxPalette(int n, const unsigned char* red,
59 const unsigned char* green,
60 const unsigned char* blue);
23324ae1
FM
61 //@}
62
63 /**
64 Destructor.
65 See @ref overview_refcountdestruct "reference-counted object destruction" for
66 more info.
67 */
68 ~wxPalette();
69
70 /**
71 Creates a palette from arrays of size @e n, one for each
72 red, blue or green component.
73
7c913512 74 @param n
4cc4bfaf 75 The number of indices in the palette.
7c913512 76 @param red
4cc4bfaf 77 An array of red values.
7c913512 78 @param green
4cc4bfaf 79 An array of green values.
7c913512 80 @param blue
4cc4bfaf 81 An array of blue values.
23324ae1
FM
82
83 @returns @true if the creation was successful, @false otherwise.
84
4cc4bfaf 85 @see wxPalette()
23324ae1
FM
86 */
87 bool Create(int n, const unsigned char* red,
88 const unsigned char* green,
89 const unsigned char* blue);
90
91 /**
92 Returns number of entries in palette.
93 */
328f5751 94 int GetColoursCount() const;
23324ae1
FM
95
96 /**
97 Returns a pixel value (index into the palette) for the given RGB values.
98
7c913512 99 @param red
4cc4bfaf 100 Red value.
7c913512 101 @param green
4cc4bfaf 102 Green value.
7c913512 103 @param blue
4cc4bfaf 104 Blue value.
23324ae1
FM
105
106 @returns The nearest palette index or wxNOT_FOUND for unexpected errors.
107
4cc4bfaf 108 @see GetRGB()
23324ae1
FM
109 */
110 int GetPixel(unsigned char red, unsigned char green,
328f5751 111 unsigned char blue) const;
23324ae1
FM
112
113 /**
114 Returns RGB values for a given palette index.
115
7c913512 116 @param pixel
4cc4bfaf 117 The palette index.
7c913512 118 @param red
4cc4bfaf 119 Receives the red value.
7c913512 120 @param green
4cc4bfaf 121 Receives the green value.
7c913512 122 @param blue
4cc4bfaf 123 Receives the blue value.
23324ae1
FM
124
125 @returns @true if the operation was successful.
126
4cc4bfaf 127 @see GetPixel()
23324ae1 128 */
4cc4bfaf
FM
129 bool GetRGB(int pixel, const unsigned char* red,
130 const unsigned char* green,
328f5751 131 const unsigned char* blue) const;
23324ae1
FM
132
133 /**
134 Returns @true if palette data is present.
135 */
328f5751 136 bool IsOk() const;
23324ae1
FM
137
138 /**
139 Assignment operator, using @ref overview_trefcount "reference counting".
140 */
141 wxPalette operator =(const wxPalette& palette);
142};
e54c96f1
FM
143
144
145/**
146 FIXME
147*/
148wxPalette Objects:
149;
150
151/**
152 FIXME
153*/
154wxPalette wxNullPalette;
155
156