]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/palette.tex
Added automatic dialog scrolling ability
[wxWidgets.git] / docs / latex / wx / palette.tex
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
14 A palette is a table that maps pixel values to RGB colours. It allows the
15 colours of a low-depth bitmap, for example, to be mapped to the available
16 colours in a display. The notion of palettes is becoming more and more
17 obsolete nowadays and only the MSW port is still using a native palette.
18 All other ports use generic code which is basically just an array of
19 colours.
20
21 It is likely that in the future the only use for palettes within wxWidgets
22 will be for representing colour indeces from images (such as GIF or PNG).
23 The image handlers for these formats have been modified to create a palette
24 if there is such information in the original image file (usually 256 or less
25 colour images). See \helpref{wxImage}{wximage} for more information.
26
27 %TODO: topic overview for wxPalette.
28 \wxheading{Derived from}
29
30 \helpref{wxGDIObject}{wxgdiobject}\\
31 \helpref{wxObject}{wxobject}
32
33 \wxheading{Include files}
34
35 <wx/palette.h>
36
37 \wxheading{Library}
38
39 \helpref{wxCore}{librarieslist}
40
41 \wxheading{Predefined objects}
42
43 Objects:
44
45 {\bf wxNullPalette}
46
47 \wxheading{See also}
48
49 \helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
50
51 \latexignore{\rtfignore{\wxheading{Members}}}
52
53 \membersection{wxPalette::wxPalette}\label{wxpalettector}
54
55 \func{}{wxPalette}{\void}
56
57 Default constructor.
58
59 \func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
60
61 Copy constructor, uses \helpref{reference counting}{trefcount}.
62
63 \func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
64 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
65
66 Creates a palette from arrays of size {\it n}, one for each
67 red, 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
85 \perlnote{In wxPerl the third constructor form takes as parameters
86 3 array references ( they must be of the same length ).}
87
88 \membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
89
90 \func{}{\destruct{wxPalette}}{\void}
91
92 Destructor.
93 See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
94
95 \membersection{wxPalette::Create}\label{wxpalettecreate}
96
97 \func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
98 \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
99
100 Creates a palette from arrays of size {\it n}, one for each
101 red, 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
115 true if the creation was successful, false otherwise.
116
117 \wxheading{See also}
118
119 \helpref{wxPalette::wxPalette}{wxpalettector}
120
121 \membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
122
123 \constfunc{int}{GetColoursCount}{\void}
124
125 Returns number of entries in palette.
126
127 \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
128
129 \constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
130 \param{unsigned char }{blue}}
131
132 Returns 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
144 The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
145
146 \wxheading{See also}
147
148 \helpref{wxPalette::GetRGB}{wxpalettegetrgb}
149
150 \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
151
152 \constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
153 \param{const unsigned char* }{blue}}
154
155 Returns 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
169 true if the operation was successful.
170
171 \wxheading{See also}
172
173 \helpref{wxPalette::GetPixel}{wxpalettegetpixel}
174
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
178 \membersection{wxPalette::IsOk}\label{wxpaletteisok}
179
180 \constfunc{bool}{IsOk}{\void}
181
182 Returns true if palette data is present.
183
184 \membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
185
186 \func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
187
188 Assignment operator, using \helpref{reference counting}{trefcount}.
189