]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/palette.tex
remove just added wxCoordRound() (see patch 1586499)
[wxWidgets.git] / docs / latex / wx / palette.tex
CommitLineData
88ef3a57
WS
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
a660d684
KB
12\section{\class{wxPalette}}\label{wxpalette}
13
df816ad9
RR
14A palette is a table that maps pixel values to RGB colours. It allows the
15colours of a low-depth bitmap, for example, to be mapped to the available
16colours in a display. The notion of palettes is becoming more and more
17obsolete nowadays and only the MSW port is still using a native palette.
18All other ports use generic code which is basically just an array of
19colours.
20
21It is likely that in the future the only use for palettes within wxWidgets
22will be for representing colour indeces from images (such as GIF or PNG).
23The image handlers for these formats have been modified to create a palette
24if there is such information in the original image file (usually 256 or less
25colour images). See \helpref{wxImage}{wximage} for more information.
a660d684 26
5b6aa0ff 27%TODO: topic overview for wxPalette.
a660d684
KB
28\wxheading{Derived from}
29
30\helpref{wxGDIObject}{wxgdiobject}\\
31\helpref{wxObject}{wxobject}
32
954b8ae6
JS
33\wxheading{Include files}
34
35<wx/palette.h>
36
20e85460
JS
37\wxheading{Predefined objects}
38
39Objects:
40
41{\bf wxNullPalette}
42
a660d684
KB
43\wxheading{See also}
44
45\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
46
47\latexignore{\rtfignore{\wxheading{Members}}}
48
dcbd177f 49\membersection{wxPalette::wxPalette}\label{wxpalettector}
a660d684
KB
50
51\func{}{wxPalette}{\void}
52
53Default constructor.
54
55\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
56
a91225b2 57Copy constructor, uses \helpref{reference counting}{trefcount}.
a660d684 58
eaaa6a06 59\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
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{palette}{A pointer or reference to the palette to copy.}
68
69\docparam{n}{The number of indices in the palette.}
70
71\docparam{red}{An array of red values.}
72
73\docparam{green}{An array of green values.}
74
75\docparam{blue}{An array of blue values.}
76
77\wxheading{See also}
78
79\helpref{wxPalette::Create}{wxpalettecreate}
80
f3539882
VZ
81\perlnote{In wxPerl the third constructor form takes as parameters
82 3 array references ( they must be of the same length ).}
83
dcbd177f 84\membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
a660d684
KB
85
86\func{}{\destruct{wxPalette}}{\void}
87
88Destructor.
55ccdb93 89See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
a660d684
KB
90
91\membersection{wxPalette::Create}\label{wxpalettecreate}
92
eaaa6a06 93\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
a660d684
KB
94 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
95
96Creates a palette from arrays of size {\it n}, one for each
97red, blue or green component.
98
99\wxheading{Parameters}
100
101\docparam{n}{The number of indices in the palette.}
102
103\docparam{red}{An array of red values.}
104
105\docparam{green}{An array of green values.}
106
107\docparam{blue}{An array of blue values.}
108
109\wxheading{Return value}
110
cc81d32f 111true if the creation was successful, false otherwise.
a660d684
KB
112
113\wxheading{See also}
114
dcbd177f 115\helpref{wxPalette::wxPalette}{wxpalettector}
a660d684 116
917be7ed
WS
117\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
118
119\constfunc{int}{GetColoursCount}{\void}
120
121Returns number of entries in palette.
122
a660d684
KB
123\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
124
88ef3a57
WS
125\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
126 \param{unsigned char }{blue}}
a660d684
KB
127
128Returns a pixel value (index into the palette) for the given RGB values.
129
130\wxheading{Parameters}
131
132\docparam{red}{Red value.}
133
134\docparam{green}{Green value.}
135
136\docparam{blue}{Blue value.}
137
138\wxheading{Return value}
139
88ef3a57 140The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
a660d684
KB
141
142\wxheading{See also}
143
144\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
145
146\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
147
0f353563 148\constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
a660d684
KB
149 \param{const unsigned char* }{blue}}
150
151Returns RGB values for a given palette index.
152
153\wxheading{Parameters}
154
155\docparam{pixel}{The palette index.}
156
157\docparam{red}{Receives the red value.}
158
159\docparam{green}{Receives the green value.}
160
161\docparam{blue}{Receives the blue value.}
162
163\wxheading{Return value}
164
cc81d32f 165true if the operation was successful.
a660d684
KB
166
167\wxheading{See also}
168
169\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
170
f3539882
VZ
171\perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
172 returns a 3-element list ( or the empty list upon failure ).}
173
b7cacb43 174\membersection{wxPalette::IsOk}\label{wxpaletteisok}
a660d684 175
b7cacb43 176\constfunc{bool}{IsOk}{\void}
a660d684 177
cc81d32f 178Returns true if palette data is present.
a660d684
KB
179
180\membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
181
182\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
183
a91225b2 184Assignment operator, using \helpref{reference counting}{trefcount}.
a660d684 185