File: wx165.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (181 lines) | stat: -rw-r--r-- 6,248 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<HTML>
<head><title>wxPalette</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxpalette"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx164.htm#wxpaintevent"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx166.htm#wxpanel"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxPalette</H2>
<P>
A palette is a table that maps pixel values to RGB colours. It allows the colours
of a low-depth bitmap, for example, to be mapped to the available colours in a display.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx107.htm#wxgdiobject">wxGDIObject</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/palette.h&gt;<P>
<B><FONT COLOR="#FF0000">Predefined objects</FONT></B><P>
Objects:<P>
<B>wxNullPalette</B><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx65.htm#wxdcsetpalette">wxDC::SetPalette</A>, <A HREF="wx32.htm#wxbitmap">wxBitmap</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxpaletteconstr">wxPalette::wxPalette</A><BR>
<A HREF="#topic634">wxPalette::~wxPalette</A><BR>
<A HREF="#wxpalettecreate">wxPalette::Create</A><BR>
<A HREF="#wxpalettegetpixel">wxPalette::GetPixel</A><BR>
<A HREF="#wxpalettegetrgb">wxPalette::GetRGB</A><BR>
<A HREF="#wxpaletteok">wxPalette::Ok</A><BR>
<A HREF="#wxpaletteassignment">wxPalette::operator =</A><BR>
<A HREF="#wxpaletteequals">wxPalette::operator ==</A><BR>
<A HREF="#wxpalettenotequals">wxPalette::operator !=</A><BR>
<P>

<HR>
<A NAME="wxpaletteconstr"></A>
<H3>wxPalette::wxPalette</H3>
<P>
<B></B> <B>wxPalette</B>()<P>
Default constructor.<P>
<B></B> <B>wxPalette</B>(<B>const wxPalette&amp;</B><I> palette</I>)<P>
Copy constructor. This uses reference counting so is a cheap operation.<P>
<B></B> <B>wxPalette</B>(<B>int</B><I> n</I>, <B>const unsigned char* </B><I>red</I>,<BR>

 <B>const unsigned char* </B><I>green</I>, <B>const unsigned char* </B><I>blue</I>)<P>
Creates a palette from arrays of size <I>n</I>, one for each
red, blue or green component.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>palette</I><UL><UL>
A pointer or reference to the palette to copy.</UL></UL>
<P>
<I>n</I><UL><UL>
The number of indices in the palette.</UL></UL>
<P>
<I>red</I><UL><UL>
An array of red values.</UL></UL>
<P>
<I>green</I><UL><UL>
An array of green values.</UL></UL>
<P>
<I>blue</I><UL><UL>
An array of blue values.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx165.htm#wxpalettecreate">wxPalette::Create</A><P>

<HR>
<A NAME="topic634"></A>
<H3>wxPalette::~wxPalette</H3>
<P>
<B></B> <B>~wxPalette</B>()<P>
Destructor.<P>

<HR>
<A NAME="wxpalettecreate"></A>
<H3>wxPalette::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>int</B><I> n</I>, <B>const unsigned char* </B><I>red</I>,
 <B>const unsigned char* </B><I>green</I>, <B>const unsigned char* </B><I>blue</I>)<P>
Creates a palette from arrays of size <I>n</I>, one for each
red, blue or green component.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>n</I><UL><UL>
The number of indices in the palette.</UL></UL>
<P>
<I>red</I><UL><UL>
An array of red values.</UL></UL>
<P>
<I>green</I><UL><UL>
An array of green values.</UL></UL>
<P>
<I>blue</I><UL><UL>
An array of blue values.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the creation was successful, FALSE otherwise.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx165.htm#wxpaletteconstr">wxPalette::wxPalette</A><P>

<HR>
<A NAME="wxpalettegetpixel"></A>
<H3>wxPalette::GetPixel</H3>
<P>
<B>int</B> <B>GetPixel</B>(<B>const unsigned char </B><I>red</I>, <B>const unsigned char </B><I>green</I>,
 <B>const unsigned char </B><I>blue</I>) <B>const</B><P>
Returns a pixel value (index into the palette) for the given RGB values.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>red</I><UL><UL>
Red value.</UL></UL>
<P>
<I>green</I><UL><UL>
Green value.</UL></UL>
<P>
<I>blue</I><UL><UL>
Blue value.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The nearest palette index.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx165.htm#wxpalettegetrgb">wxPalette::GetRGB</A><P>

<HR>
<A NAME="wxpalettegetrgb"></A>
<H3>wxPalette::GetRGB</H3>
<P>
<B>bool</B> <B>GetPixel</B>(<B>int</B><I> pixel</I>, <B>const unsigned char* </B><I>red</I>, <B>const unsigned char* </B><I>green</I>,
 <B>const unsigned char* </B><I>blue</I>) <B>const</B><P>
Returns RGB values for a given palette index.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pixel</I><UL><UL>
The palette index.</UL></UL>
<P>
<I>red</I><UL><UL>
Receives the red value.</UL></UL>
<P>
<I>green</I><UL><UL>
Receives the green value.</UL></UL>
<P>
<I>blue</I><UL><UL>
Receives the blue value.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the operation was successful.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx165.htm#wxpalettegetpixel">wxPalette::GetPixel</A><P>

<HR>
<A NAME="wxpaletteok"></A>
<H3>wxPalette::Ok</H3>
<P>
<B>bool</B> <B>Ok</B>() <B>const</B><P>
Returns TRUE if palette data is present.<P>

<HR>
<A NAME="wxpaletteassignment"></A>
<H3>wxPalette::operator =</H3>
<P>
<B>wxPalette&amp;</B> <B>operator =</B>(<B>const wxPalette&amp; </B><I>palette</I>)<P>
Assignment operator, using reference counting. Returns a reference
to 'this'.<P>

<HR>
<A NAME="wxpaletteequals"></A>
<H3>wxPalette::operator ==</H3>
<P>
<B>bool</B> <B>operator ==</B>(<B>const wxPalette&amp; </B><I>palette</I>)<P>
Equality operator. Two palettes are equal if they contain pointers
to the same underlying palette data. It does not compare each attribute,
so two independently-created palettes using the same parameters will
fail the test.<P>

<HR>
<A NAME="wxpalettenotequals"></A>
<H3>wxPalette::operator !=</H3>
<P>
<B>bool</B> <B>operator !=</B>(<B>const wxPalette&amp; </B><I>palette</I>)<P>
Inequality operator. Two palettes are not equal if they contain pointers
to different underlying palette data. It does not compare each attribute.<P>


</BODY></HTML>