]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxPalette}}\label{wxpalette} |
2 | ||
3 | A palette is a table that maps pixel values to RGB colours. It allows the colours | |
4 | of a low-depth bitmap, for example, to be mapped to the available colours in a display. | |
5 | ||
5b6aa0ff | 6 | %TODO: topic overview for wxPalette. |
a660d684 KB |
7 | \wxheading{Derived from} |
8 | ||
9 | \helpref{wxGDIObject}{wxgdiobject}\\ | |
10 | \helpref{wxObject}{wxobject} | |
11 | ||
954b8ae6 JS |
12 | \wxheading{Include files} |
13 | ||
14 | <wx/palette.h> | |
15 | ||
20e85460 JS |
16 | \wxheading{Predefined objects} |
17 | ||
18 | Objects: | |
19 | ||
20 | {\bf wxNullPalette} | |
21 | ||
a660d684 KB |
22 | \wxheading{See also} |
23 | ||
24 | \helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap} | |
25 | ||
26 | \latexignore{\rtfignore{\wxheading{Members}}} | |
27 | ||
dcbd177f | 28 | \membersection{wxPalette::wxPalette}\label{wxpalettector} |
a660d684 KB |
29 | |
30 | \func{}{wxPalette}{\void} | |
31 | ||
32 | Default constructor. | |
33 | ||
34 | \func{}{wxPalette}{\param{const wxPalette\&}{ palette}} | |
35 | ||
36 | Copy constructor. This uses reference counting so is a cheap operation. | |
37 | ||
eaaa6a06 | 38 | \func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\ |
a660d684 KB |
39 | \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}} |
40 | ||
41 | Creates a palette from arrays of size {\it n}, one for each | |
42 | red, blue or green component. | |
43 | ||
44 | \wxheading{Parameters} | |
45 | ||
46 | \docparam{palette}{A pointer or reference to the palette to copy.} | |
47 | ||
48 | \docparam{n}{The number of indices in the palette.} | |
49 | ||
50 | \docparam{red}{An array of red values.} | |
51 | ||
52 | \docparam{green}{An array of green values.} | |
53 | ||
54 | \docparam{blue}{An array of blue values.} | |
55 | ||
56 | \wxheading{See also} | |
57 | ||
58 | \helpref{wxPalette::Create}{wxpalettecreate} | |
59 | ||
f3539882 VZ |
60 | \perlnote{In wxPerl the third constructor form takes as parameters |
61 | 3 array references ( they must be of the same length ).} | |
62 | ||
dcbd177f | 63 | \membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor} |
a660d684 KB |
64 | |
65 | \func{}{\destruct{wxPalette}}{\void} | |
66 | ||
67 | Destructor. | |
68 | ||
69 | \membersection{wxPalette::Create}\label{wxpalettecreate} | |
70 | ||
eaaa6a06 | 71 | \func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp |
a660d684 KB |
72 | \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}} |
73 | ||
74 | Creates a palette from arrays of size {\it n}, one for each | |
75 | red, blue or green component. | |
76 | ||
77 | \wxheading{Parameters} | |
78 | ||
79 | \docparam{n}{The number of indices in the palette.} | |
80 | ||
81 | \docparam{red}{An array of red values.} | |
82 | ||
83 | \docparam{green}{An array of green values.} | |
84 | ||
85 | \docparam{blue}{An array of blue values.} | |
86 | ||
87 | \wxheading{Return value} | |
88 | ||
cc81d32f | 89 | true if the creation was successful, false otherwise. |
a660d684 KB |
90 | |
91 | \wxheading{See also} | |
92 | ||
dcbd177f | 93 | \helpref{wxPalette::wxPalette}{wxpalettector} |
a660d684 | 94 | |
917be7ed WS |
95 | \membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount} |
96 | ||
97 | \constfunc{int}{GetColoursCount}{\void} | |
98 | ||
99 | Returns number of entries in palette. | |
100 | ||
a660d684 KB |
101 | \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel} |
102 | ||
103 | \constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp | |
104 | \param{const unsigned char }{blue}} | |
105 | ||
106 | Returns a pixel value (index into the palette) for the given RGB values. | |
107 | ||
108 | \wxheading{Parameters} | |
109 | ||
110 | \docparam{red}{Red value.} | |
111 | ||
112 | \docparam{green}{Green value.} | |
113 | ||
114 | \docparam{blue}{Blue value.} | |
115 | ||
116 | \wxheading{Return value} | |
117 | ||
118 | The nearest palette index. | |
119 | ||
120 | \wxheading{See also} | |
121 | ||
122 | \helpref{wxPalette::GetRGB}{wxpalettegetrgb} | |
123 | ||
124 | \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb} | |
125 | ||
eaaa6a06 | 126 | \constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp |
a660d684 KB |
127 | \param{const unsigned char* }{blue}} |
128 | ||
129 | Returns RGB values for a given palette index. | |
130 | ||
131 | \wxheading{Parameters} | |
132 | ||
133 | \docparam{pixel}{The palette index.} | |
134 | ||
135 | \docparam{red}{Receives the red value.} | |
136 | ||
137 | \docparam{green}{Receives the green value.} | |
138 | ||
139 | \docparam{blue}{Receives the blue value.} | |
140 | ||
141 | \wxheading{Return value} | |
142 | ||
cc81d32f | 143 | true if the operation was successful. |
a660d684 KB |
144 | |
145 | \wxheading{See also} | |
146 | ||
147 | \helpref{wxPalette::GetPixel}{wxpalettegetpixel} | |
148 | ||
f3539882 VZ |
149 | \perlnote{In wxPerl this method takes only the {\tt pixel} parameter and |
150 | returns a 3-element list ( or the empty list upon failure ).} | |
151 | ||
a660d684 KB |
152 | \membersection{wxPalette::Ok}\label{wxpaletteok} |
153 | ||
154 | \constfunc{bool}{Ok}{\void} | |
155 | ||
cc81d32f | 156 | Returns true if palette data is present. |
a660d684 KB |
157 | |
158 | \membersection{wxPalette::operator $=$}\label{wxpaletteassignment} | |
159 | ||
160 | \func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}} | |
161 | ||
162 | Assignment operator, using reference counting. Returns a reference | |
163 | to `this'. | |
164 | ||
165 | \membersection{wxPalette::operator $==$}\label{wxpaletteequals} | |
166 | ||
167 | \func{bool}{operator $==$}{\param{const wxPalette\& }{palette}} | |
168 | ||
169 | Equality operator. Two palettes are equal if they contain pointers | |
170 | to the same underlying palette data. It does not compare each attribute, | |
171 | so two independently-created palettes using the same parameters will | |
172 | fail the test. | |
173 | ||
174 | \membersection{wxPalette::operator $!=$}\label{wxpalettenotequals} | |
175 | ||
176 | \func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}} | |
177 | ||
178 | Inequality operator. Two palettes are not equal if they contain pointers | |
179 | to different underlying palette data. It does not compare each attribute. | |
180 | ||
181 |