]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/palette.tex
Updated docs
[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 \membersection{wxPalette::\destruct{wxPalette}}
61
62 \func{}{\destruct{wxPalette}}{\void}
63
64 Destructor.
65
66 \membersection{wxPalette::Create}\label{wxpalettecreate}
67
68 \func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
69 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
70
71 Creates a palette from arrays of size {\it n}, one for each
72 red, blue or green component.
73
74 \wxheading{Parameters}
75
76 \docparam{n}{The number of indices in the palette.}
77
78 \docparam{red}{An array of red values.}
79
80 \docparam{green}{An array of green values.}
81
82 \docparam{blue}{An array of blue values.}
83
84 \wxheading{Return value}
85
86 TRUE if the creation was successful, FALSE otherwise.
87
88 \wxheading{See also}
89
90 \helpref{wxPalette::wxPalette}{wxpaletteconstr}
91
92 \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
93
94 \constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
95 \param{const unsigned char }{blue}}
96
97 Returns a pixel value (index into the palette) for the given RGB values.
98
99 \wxheading{Parameters}
100
101 \docparam{red}{Red value.}
102
103 \docparam{green}{Green value.}
104
105 \docparam{blue}{Blue value.}
106
107 \wxheading{Return value}
108
109 The nearest palette index.
110
111 \wxheading{See also}
112
113 \helpref{wxPalette::GetRGB}{wxpalettegetrgb}
114
115 \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
116
117 \constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
118 \param{const unsigned char* }{blue}}
119
120 Returns RGB values for a given palette index.
121
122 \wxheading{Parameters}
123
124 \docparam{pixel}{The palette index.}
125
126 \docparam{red}{Receives the red value.}
127
128 \docparam{green}{Receives the green value.}
129
130 \docparam{blue}{Receives the blue value.}
131
132 \wxheading{Return value}
133
134 TRUE if the operation was successful.
135
136 \wxheading{See also}
137
138 \helpref{wxPalette::GetPixel}{wxpalettegetpixel}
139
140 \membersection{wxPalette::Ok}\label{wxpaletteok}
141
142 \constfunc{bool}{Ok}{\void}
143
144 Returns TRUE if palette data is present.
145
146 \membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
147
148 \func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
149
150 Assignment operator, using reference counting. Returns a reference
151 to `this'.
152
153 \membersection{wxPalette::operator $==$}\label{wxpaletteequals}
154
155 \func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
156
157 Equality operator. Two palettes are equal if they contain pointers
158 to the same underlying palette data. It does not compare each attribute,
159 so two independently-created palettes using the same parameters will
160 fail the test.
161
162 \membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
163
164 \func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
165
166 Inequality operator. Two palettes are not equal if they contain pointers
167 to different underlying palette data. It does not compare each attribute.
168
169