]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/palette.tex
Removed more traces of wxrcedit
[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{wxpalettector}
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}}\label{wxpalettedtor}
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}{wxpalettector}
94
95 \membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
96
97 \constfunc{int}{GetColoursCount}{\void}
98
99 Returns number of entries in palette.
100
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
126 \constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
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
143 true if the operation was successful.
144
145 \wxheading{See also}
146
147 \helpref{wxPalette::GetPixel}{wxpalettegetpixel}
148
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
152 \membersection{wxPalette::Ok}\label{wxpaletteok}
153
154 \constfunc{bool}{Ok}{\void}
155
156 Returns true if palette data is present.
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