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