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