1 \section{\class{wxPalette
}}\label{wxpalette
}
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.
6 %TODO: topic overview for wxPalette.
7 \wxheading{Derived from
}
9 \helpref{wxGDIObject
}{wxgdiobject
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Include files
}
18 \helpref{wxDC::SetPalette
}{wxdcsetpalette
},
\helpref{wxBitmap
}{wxbitmap
}
20 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxPalette::wxPalette
}\label{wxpaletteconstr
}
24 \func{}{wxPalette
}{\void}
28 \func{}{wxPalette
}{\param{const wxPalette\&
}{ palette
}}
30 Copy constructor. This uses reference counting so is a cheap operation.
32 \func{}{wxPalette
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},\\
33 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
35 Creates a palette from arrays of size
{\it n
}, one for each
36 red, blue or green component.
38 \wxheading{Parameters
}
40 \docparam{palette
}{A pointer or reference to the palette to copy.
}
42 \docparam{n
}{The number of indices in the palette.
}
44 \docparam{red
}{An array of red values.
}
46 \docparam{green
}{An array of green values.
}
48 \docparam{blue
}{An array of blue values.
}
52 \helpref{wxPalette::Create
}{wxpalettecreate
}
54 \membersection{wxPalette::
\destruct{wxPalette
}}
56 \func{}{\destruct{wxPalette
}}{\void}
60 \membersection{wxPalette::Create
}\label{wxpalettecreate
}
62 \func{bool
}{Create
}{\param{int
}{ n
},
\param{const unsigned char*
}{red
},
\rtfsp
63 \param{const unsigned char*
}{green
},
\param{const unsigned char*
}{blue
}}
65 Creates a palette from arrays of size
{\it n
}, one for each
66 red, blue or green component.
68 \wxheading{Parameters
}
70 \docparam{n
}{The number of indices in the palette.
}
72 \docparam{red
}{An array of red values.
}
74 \docparam{green
}{An array of green values.
}
76 \docparam{blue
}{An array of blue values.
}
78 \wxheading{Return value
}
80 TRUE if the creation was successful, FALSE otherwise.
84 \helpref{wxPalette::wxPalette
}{wxpaletteconstr
}
86 \membersection{wxPalette::GetPixel
}\label{wxpalettegetpixel
}
88 \constfunc{int
}{GetPixel
}{\param{const unsigned char
}{red
},
\param{const unsigned char
}{green
},
\rtfsp
89 \param{const unsigned char
}{blue
}}
91 Returns a pixel value (index into the palette) for the given RGB values.
93 \wxheading{Parameters
}
95 \docparam{red
}{Red value.
}
97 \docparam{green
}{Green value.
}
99 \docparam{blue
}{Blue value.
}
101 \wxheading{Return value
}
103 The nearest palette index.
107 \helpref{wxPalette::GetRGB
}{wxpalettegetrgb
}
109 \membersection{wxPalette::GetRGB
}\label{wxpalettegetrgb
}
111 \constfunc{bool
}{GetPixel
}{\param{int
}{ pixel
},
\param{const unsigned char*
}{red
},
\param{const unsigned char*
}{green
},
\rtfsp
112 \param{const unsigned char*
}{blue
}}
114 Returns RGB values for a given palette index.
116 \wxheading{Parameters
}
118 \docparam{pixel
}{The palette index.
}
120 \docparam{red
}{Receives the red value.
}
122 \docparam{green
}{Receives the green value.
}
124 \docparam{blue
}{Receives the blue value.
}
126 \wxheading{Return value
}
128 TRUE if the operation was successful.
132 \helpref{wxPalette::GetPixel
}{wxpalettegetpixel
}
134 \membersection{wxPalette::Ok
}\label{wxpaletteok
}
136 \constfunc{bool
}{Ok
}{\void}
138 Returns TRUE if palette data is present.
140 \membersection{wxPalette::operator $=$
}\label{wxpaletteassignment
}
142 \func{wxPalette\&
}{operator $=$
}{\param{const wxPalette\&
}{palette
}}
144 Assignment operator, using reference counting. Returns a reference
147 \membersection{wxPalette::operator $==$
}\label{wxpaletteequals
}
149 \func{bool
}{operator $==$
}{\param{const wxPalette\&
}{palette
}}
151 Equality operator. Two palettes are equal if they contain pointers
152 to the same underlying palette data. It does not compare each attribute,
153 so two independently-created palettes using the same parameters will
156 \membersection{wxPalette::operator $!=$
}\label{wxpalettenotequals
}
158 \func{bool
}{operator $!=$
}{\param{const wxPalette\&
}{palette
}}
160 Inequality operator. Two palettes are not equal if they contain pointers
161 to different underlying palette data. It does not compare each attribute.