]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/palette.tex
Applied patch [ 791648 ] wxDateTime: note unimplemented methods
[wxWidgets.git] / docs / latex / wx / palette.tex
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
6 %TODO: topic overview for wxPalette.
7 \wxheading{Derived from}
8
9 \helpref{wxGDIObject}{wxgdiobject}\\
10 \helpref{wxObject}{wxobject}
11
12 \wxheading{Include files}
13
14 <wx/palette.h>
15
16 \wxheading{Predefined objects}
17
18 Objects:
19
20 {\bf wxNullPalette}
21
22 \wxheading{See also}
23
24 \helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
25
26 \latexignore{\rtfignore{\wxheading{Members}}}
27
28 \membersection{wxPalette::wxPalette}\label{wxpaletteconstr}
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
38 \func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
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
60 \perlnote{In wxPerl the third constructor form takes as parameters
61 3 array references ( they must be of the same length ).}
62
63 \membersection{wxPalette::\destruct{wxPalette}}
64
65 \func{}{\destruct{wxPalette}}{\void}
66
67 Destructor.
68
69 \membersection{wxPalette::Create}\label{wxpalettecreate}
70
71 \func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
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
89 true if the creation was successful, false otherwise.
90
91 \wxheading{See also}
92
93 \helpref{wxPalette::wxPalette}{wxpaletteconstr}
94
95 \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
96
97 \constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
98 \param{const unsigned char }{blue}}
99
100 Returns a pixel value (index into the palette) for the given RGB values.
101
102 \wxheading{Parameters}
103
104 \docparam{red}{Red value.}
105
106 \docparam{green}{Green value.}
107
108 \docparam{blue}{Blue value.}
109
110 \wxheading{Return value}
111
112 The nearest palette index.
113
114 \wxheading{See also}
115
116 \helpref{wxPalette::GetRGB}{wxpalettegetrgb}
117
118 \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
119
120 \constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
121 \param{const unsigned char* }{blue}}
122
123 Returns RGB values for a given palette index.
124
125 \wxheading{Parameters}
126
127 \docparam{pixel}{The palette index.}
128
129 \docparam{red}{Receives the red value.}
130
131 \docparam{green}{Receives the green value.}
132
133 \docparam{blue}{Receives the blue value.}
134
135 \wxheading{Return value}
136
137 true if the operation was successful.
138
139 \wxheading{See also}
140
141 \helpref{wxPalette::GetPixel}{wxpalettegetpixel}
142
143 \perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
144 returns a 3-element list ( or the empty list upon failure ).}
145
146 \membersection{wxPalette::Ok}\label{wxpaletteok}
147
148 \constfunc{bool}{Ok}{\void}
149
150 Returns true if palette data is present.
151
152 \membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
153
154 \func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
155
156 Assignment operator, using reference counting. Returns a reference
157 to `this'.
158
159 \membersection{wxPalette::operator $==$}\label{wxpaletteequals}
160
161 \func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
162
163 Equality operator. Two palettes are equal if they contain pointers
164 to the same underlying palette data. It does not compare each attribute,
165 so two independently-created palettes using the same parameters will
166 fail the test.
167
168 \membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
169
170 \func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
171
172 Inequality operator. Two palettes are not equal if they contain pointers
173 to different underlying palette data. It does not compare each attribute.
174
175