]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/palette.tex
clarify global wxConfig object life-management
[wxWidgets.git] / docs / latex / wx / palette.tex
... / ...
CommitLineData
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: palette.tex
3%% Purpose: wxPalette docs
4%% Author:
5%% Modified by:
6%% Created:
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxPalette}}\label{wxpalette}
13
14A palette is a table that maps pixel values to RGB colours. It allows the colours
15of a low-depth bitmap, for example, to be mapped to the available colours in a display.
16
17%TODO: topic overview for wxPalette.
18\wxheading{Derived from}
19
20\helpref{wxGDIObject}{wxgdiobject}\\
21\helpref{wxObject}{wxobject}
22
23\wxheading{Include files}
24
25<wx/palette.h>
26
27\wxheading{Predefined objects}
28
29Objects:
30
31{\bf wxNullPalette}
32
33\wxheading{See also}
34
35\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
36
37\latexignore{\rtfignore{\wxheading{Members}}}
38
39\membersection{wxPalette::wxPalette}\label{wxpalettector}
40
41\func{}{wxPalette}{\void}
42
43Default constructor.
44
45\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
46
47Copy constructor. This uses reference counting so is a cheap operation.
48
49\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
50 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
51
52Creates a palette from arrays of size {\it n}, one for each
53red, blue or green component.
54
55\wxheading{Parameters}
56
57\docparam{palette}{A pointer or reference to the palette to copy.}
58
59\docparam{n}{The number of indices in the palette.}
60
61\docparam{red}{An array of red values.}
62
63\docparam{green}{An array of green values.}
64
65\docparam{blue}{An array of blue values.}
66
67\wxheading{See also}
68
69\helpref{wxPalette::Create}{wxpalettecreate}
70
71\perlnote{In wxPerl the third constructor form takes as parameters
72 3 array references ( they must be of the same length ).}
73
74\membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
75
76\func{}{\destruct{wxPalette}}{\void}
77
78Destructor.
79
80\membersection{wxPalette::Create}\label{wxpalettecreate}
81
82\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
83 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
84
85Creates a palette from arrays of size {\it n}, one for each
86red, blue or green component.
87
88\wxheading{Parameters}
89
90\docparam{n}{The number of indices in the palette.}
91
92\docparam{red}{An array of red values.}
93
94\docparam{green}{An array of green values.}
95
96\docparam{blue}{An array of blue values.}
97
98\wxheading{Return value}
99
100true if the creation was successful, false otherwise.
101
102\wxheading{See also}
103
104\helpref{wxPalette::wxPalette}{wxpalettector}
105
106\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
107
108\constfunc{int}{GetColoursCount}{\void}
109
110Returns number of entries in palette.
111
112\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
113
114\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
115 \param{unsigned char }{blue}}
116
117Returns a pixel value (index into the palette) for the given RGB values.
118
119\wxheading{Parameters}
120
121\docparam{red}{Red value.}
122
123\docparam{green}{Green value.}
124
125\docparam{blue}{Blue value.}
126
127\wxheading{Return value}
128
129The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
130
131\wxheading{See also}
132
133\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
134
135\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
136
137\constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
138 \param{const unsigned char* }{blue}}
139
140Returns RGB values for a given palette index.
141
142\wxheading{Parameters}
143
144\docparam{pixel}{The palette index.}
145
146\docparam{red}{Receives the red value.}
147
148\docparam{green}{Receives the green value.}
149
150\docparam{blue}{Receives the blue value.}
151
152\wxheading{Return value}
153
154true if the operation was successful.
155
156\wxheading{See also}
157
158\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
159
160\perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
161 returns a 3-element list ( or the empty list upon failure ).}
162
163\membersection{wxPalette::Ok}\label{wxpaletteok}
164
165\constfunc{bool}{Ok}{\void}
166
167Returns true if palette data is present.
168
169\membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
170
171\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
172
173Assignment operator, using reference counting. Returns a reference
174to `this'.
175
176\membersection{wxPalette::operator $==$}\label{wxpaletteequals}
177
178\func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
179
180Equality operator. Two palettes are equal if they contain pointers
181to the same underlying palette data. It does not compare each attribute,
182so two independently-created palettes using the same parameters will
183fail the test.
184
185\membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
186
187\func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
188
189Inequality operator. Two palettes are not equal if they contain pointers
190to different underlying palette data. It does not compare each attribute.