]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/palette.tex
added wxWindow::AlwaysShowScrollbars() and its wxMac implementation
[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
a7af285d
VZ
37\wxheading{Library}
38
39\helpref{wxCore}{librarieslist}
40
20e85460
JS
41\wxheading{Predefined objects}
42
43Objects:
44
45{\bf wxNullPalette}
46
a660d684
KB
47\wxheading{See also}
48
49\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
50
51\latexignore{\rtfignore{\wxheading{Members}}}
52
dcbd177f 53\membersection{wxPalette::wxPalette}\label{wxpalettector}
a660d684
KB
54
55\func{}{wxPalette}{\void}
56
57Default constructor.
58
59\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
60
a91225b2 61Copy constructor, uses \helpref{reference counting}{trefcount}.
a660d684 62
eaaa6a06 63\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
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{palette}{A pointer or reference to the palette to copy.}
72
73\docparam{n}{The number of indices in the palette.}
74
75\docparam{red}{An array of red values.}
76
77\docparam{green}{An array of green values.}
78
79\docparam{blue}{An array of blue values.}
80
81\wxheading{See also}
82
83\helpref{wxPalette::Create}{wxpalettecreate}
84
f3539882
VZ
85\perlnote{In wxPerl the third constructor form takes as parameters
86 3 array references ( they must be of the same length ).}
87
dcbd177f 88\membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
a660d684
KB
89
90\func{}{\destruct{wxPalette}}{\void}
91
92Destructor.
55ccdb93 93See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
a660d684
KB
94
95\membersection{wxPalette::Create}\label{wxpalettecreate}
96
eaaa6a06 97\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
a660d684
KB
98 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
99
100Creates a palette from arrays of size {\it n}, one for each
101red, blue or green component.
102
103\wxheading{Parameters}
104
105\docparam{n}{The number of indices in the palette.}
106
107\docparam{red}{An array of red values.}
108
109\docparam{green}{An array of green values.}
110
111\docparam{blue}{An array of blue values.}
112
113\wxheading{Return value}
114
cc81d32f 115true if the creation was successful, false otherwise.
a660d684
KB
116
117\wxheading{See also}
118
dcbd177f 119\helpref{wxPalette::wxPalette}{wxpalettector}
a660d684 120
917be7ed
WS
121\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
122
123\constfunc{int}{GetColoursCount}{\void}
124
125Returns number of entries in palette.
126
a660d684
KB
127\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
128
88ef3a57
WS
129\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
130 \param{unsigned char }{blue}}
a660d684
KB
131
132Returns a pixel value (index into the palette) for the given RGB values.
133
134\wxheading{Parameters}
135
136\docparam{red}{Red value.}
137
138\docparam{green}{Green value.}
139
140\docparam{blue}{Blue value.}
141
142\wxheading{Return value}
143
88ef3a57 144The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
a660d684
KB
145
146\wxheading{See also}
147
148\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
149
150\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
151
0f353563 152\constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
a660d684
KB
153 \param{const unsigned char* }{blue}}
154
155Returns RGB values for a given palette index.
156
157\wxheading{Parameters}
158
159\docparam{pixel}{The palette index.}
160
161\docparam{red}{Receives the red value.}
162
163\docparam{green}{Receives the green value.}
164
165\docparam{blue}{Receives the blue value.}
166
167\wxheading{Return value}
168
cc81d32f 169true if the operation was successful.
a660d684
KB
170
171\wxheading{See also}
172
173\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
174
f3539882
VZ
175\perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
176 returns a 3-element list ( or the empty list upon failure ).}
177
b7cacb43 178\membersection{wxPalette::IsOk}\label{wxpaletteisok}
a660d684 179
b7cacb43 180\constfunc{bool}{IsOk}{\void}
a660d684 181
cc81d32f 182Returns true if palette data is present.
a660d684
KB
183
184\membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
185
186\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
187
a91225b2 188Assignment operator, using \helpref{reference counting}{trefcount}.
a660d684 189