]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/palette.tex
File/dir dialog styles and other changes (patch 1488371):
[wxWidgets.git] / docs / latex / wx / palette.tex
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
12 \section{\class{wxPalette}}\label{wxpalette}
13
14 A palette is a table that maps pixel values to RGB colours. It allows the colours
15 of a low-depth bitmap, for example, to be mapped to the available colours in a display.
16
17 %TODO: topic overview for wxPalette.
18 \wxheading{Derived from}
19
20 \helpref{wxGDIObject}{wxgdiobject}\\
21 \helpref{wxObject}{wxobject}
22
23 \wxheading{Include files}
24
25 <wx/palette.h>
26
27 \wxheading{Predefined objects}
28
29 Objects:
30
31 {\bf wxNullPalette}
32
33 \wxheading{See also}
34
35 \helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
36
37 \latexignore{\rtfignore{\wxheading{Members}}}
38
39 \membersection{wxPalette::wxPalette}\label{wxpalettector}
40
41 \func{}{wxPalette}{\void}
42
43 Default constructor.
44
45 \func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
46
47 Copy constructor. This uses reference counting so is a cheap operation.
48
49 \func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
50 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
51
52 Creates a palette from arrays of size {\it n}, one for each
53 red, 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
71 \perlnote{In wxPerl the third constructor form takes as parameters
72 3 array references ( they must be of the same length ).}
73
74 \membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
75
76 \func{}{\destruct{wxPalette}}{\void}
77
78 Destructor.
79
80 \membersection{wxPalette::Create}\label{wxpalettecreate}
81
82 \func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
83 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
84
85 Creates a palette from arrays of size {\it n}, one for each
86 red, 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
100 true if the creation was successful, false otherwise.
101
102 \wxheading{See also}
103
104 \helpref{wxPalette::wxPalette}{wxpalettector}
105
106 \membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
107
108 \constfunc{int}{GetColoursCount}{\void}
109
110 Returns number of entries in palette.
111
112 \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
113
114 \constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
115 \param{unsigned char }{blue}}
116
117 Returns 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
129 The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
130
131 \wxheading{See also}
132
133 \helpref{wxPalette::GetRGB}{wxpalettegetrgb}
134
135 \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
136
137 \constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
138 \param{const unsigned char* }{blue}}
139
140 Returns 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
154 true if the operation was successful.
155
156 \wxheading{See also}
157
158 \helpref{wxPalette::GetPixel}{wxpalettegetpixel}
159
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
163 \membersection{wxPalette::Ok}\label{wxpaletteok}
164
165 \constfunc{bool}{Ok}{\void}
166
167 Returns true if palette data is present.
168
169 \membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
170
171 \func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
172
173 Assignment operator, using reference counting. Returns a reference
174 to `this'.
175
176 \membersection{wxPalette::operator $==$}\label{wxpaletteequals}
177
178 \func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
179
180 Equality operator. Two palettes are equal if they contain pointers
181 to the same underlying palette data. It does not compare each attribute,
182 so two independently-created palettes using the same parameters will
183 fail the test.
184
185 \membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
186
187 \func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
188
189 Inequality operator. Two palettes are not equal if they contain pointers
190 to different underlying palette data. It does not compare each attribute.