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