]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/palette.tex
Overwrote(!!) with source files that compile and link with latest wxGTK.
[wxWidgets.git] / docs / latex / wx / palette.tex
CommitLineData
a660d684
KB
1\section{\class{wxPalette}}\label{wxpalette}
2
3A palette is a table that maps pixel values to RGB colours. It allows the colours
4of a low-depth bitmap, for example, to be mapped to the available colours in a display.
5
6TODO: topic overview for wxPalette.
7
8\wxheading{Derived from}
9
10\helpref{wxGDIObject}{wxgdiobject}\\
11\helpref{wxObject}{wxobject}
12
13\wxheading{See also}
14
15\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
16
17\latexignore{\rtfignore{\wxheading{Members}}}
18
19\membersection{wxPalette::wxPalette}\label{wxpaletteconstr}
20
21\func{}{wxPalette}{\void}
22
23Default constructor.
24
25\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
26
27Copy constructor. This uses reference counting so is a cheap operation.
28
29\func{}{wxPalette}{\param{const wxPalette*}{ palette}}
30
31Copy constructor. This uses reference counting so is a cheap operation.
32
eaaa6a06 33\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
a660d684
KB
34 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
35
36Creates a palette from arrays of size {\it n}, one for each
37red, blue or green component.
38
39\wxheading{Parameters}
40
41\docparam{palette}{A pointer or reference to the palette to copy.}
42
43\docparam{n}{The number of indices in the palette.}
44
45\docparam{red}{An array of red values.}
46
47\docparam{green}{An array of green values.}
48
49\docparam{blue}{An array of blue values.}
50
51\wxheading{See also}
52
53\helpref{wxPalette::Create}{wxpalettecreate}
54
55\membersection{wxPalette::\destruct{wxPalette}}
56
57\func{}{\destruct{wxPalette}}{\void}
58
59Destructor.
60
61\membersection{wxPalette::Create}\label{wxpalettecreate}
62
eaaa6a06 63\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
a660d684
KB
64 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
65
66Creates a palette from arrays of size {\it n}, one for each
67red, blue or green component.
68
69\wxheading{Parameters}
70
71\docparam{n}{The number of indices in the palette.}
72
73\docparam{red}{An array of red values.}
74
75\docparam{green}{An array of green values.}
76
77\docparam{blue}{An array of blue values.}
78
79\wxheading{Return value}
80
81TRUE if the creation was successful, FALSE otherwise.
82
83\wxheading{See also}
84
85\helpref{wxPalette::wxPalette}{wxpaletteconstr}
86
87\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
88
89\constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
90 \param{const unsigned char }{blue}}
91
92Returns a pixel value (index into the palette) for the given RGB values.
93
94\wxheading{Parameters}
95
96\docparam{red}{Red value.}
97
98\docparam{green}{Green value.}
99
100\docparam{blue}{Blue value.}
101
102\wxheading{Return value}
103
104The nearest palette index.
105
106\wxheading{See also}
107
108\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
109
110\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
111
eaaa6a06 112\constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
a660d684
KB
113 \param{const unsigned char* }{blue}}
114
115Returns RGB values for a given palette index.
116
117\wxheading{Parameters}
118
119\docparam{pixel}{The palette index.}
120
121\docparam{red}{Receives the red value.}
122
123\docparam{green}{Receives the green value.}
124
125\docparam{blue}{Receives the blue value.}
126
127\wxheading{Return value}
128
129TRUE if the operation was successful.
130
131\wxheading{See also}
132
133\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
134
135\membersection{wxPalette::Ok}\label{wxpaletteok}
136
137\constfunc{bool}{Ok}{\void}
138
139Returns TRUE if palette data is present.
140
141\membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
142
143\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
144
145Assignment operator, using reference counting. Returns a reference
146to `this'.
147
148\membersection{wxPalette::operator $==$}\label{wxpaletteequals}
149
150\func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
151
152Equality operator. Two palettes are equal if they contain pointers
153to the same underlying palette data. It does not compare each attribute,
154so two independently-created palettes using the same parameters will
155fail the test.
156
157\membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
158
159\func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
160
161Inequality operator. Two palettes are not equal if they contain pointers
162to different underlying palette data. It does not compare each attribute.
163
164