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