f35398824b
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
176 lines
4.4 KiB
TeX
176 lines
4.4 KiB
TeX
\section{\class{wxPalette}}\label{wxpalette}
|
|
|
|
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.
|
|
|
|
%TODO: topic overview for wxPalette.
|
|
\wxheading{Derived from}
|
|
|
|
\helpref{wxGDIObject}{wxgdiobject}\\
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
\wxheading{Include files}
|
|
|
|
<wx/palette.h>
|
|
|
|
\wxheading{Predefined objects}
|
|
|
|
Objects:
|
|
|
|
{\bf wxNullPalette}
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
\membersection{wxPalette::wxPalette}\label{wxpaletteconstr}
|
|
|
|
\func{}{wxPalette}{\void}
|
|
|
|
Default constructor.
|
|
|
|
\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
|
|
|
|
Copy constructor. This uses reference counting so is a cheap operation.
|
|
|
|
\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
|
|
\param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
|
|
|
|
Creates a palette from arrays of size {\it n}, one for each
|
|
red, blue or green component.
|
|
|
|
\wxheading{Parameters}
|
|
|
|
\docparam{palette}{A pointer or reference to the palette to copy.}
|
|
|
|
\docparam{n}{The number of indices in the palette.}
|
|
|
|
\docparam{red}{An array of red values.}
|
|
|
|
\docparam{green}{An array of green values.}
|
|
|
|
\docparam{blue}{An array of blue values.}
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxPalette::Create}{wxpalettecreate}
|
|
|
|
\perlnote{In wxPerl the third constructor form takes as parameters
|
|
3 array references ( they must be of the same length ).}
|
|
|
|
\membersection{wxPalette::\destruct{wxPalette}}
|
|
|
|
\func{}{\destruct{wxPalette}}{\void}
|
|
|
|
Destructor.
|
|
|
|
\membersection{wxPalette::Create}\label{wxpalettecreate}
|
|
|
|
\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
|
|
\param{const unsigned char* }{green}, \param{const unsigned char* }{blue}}
|
|
|
|
Creates a palette from arrays of size {\it n}, one for each
|
|
red, blue or green component.
|
|
|
|
\wxheading{Parameters}
|
|
|
|
\docparam{n}{The number of indices in the palette.}
|
|
|
|
\docparam{red}{An array of red values.}
|
|
|
|
\docparam{green}{An array of green values.}
|
|
|
|
\docparam{blue}{An array of blue values.}
|
|
|
|
\wxheading{Return value}
|
|
|
|
TRUE if the creation was successful, FALSE otherwise.
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxPalette::wxPalette}{wxpaletteconstr}
|
|
|
|
\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
|
|
|
|
\constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp
|
|
\param{const unsigned char }{blue}}
|
|
|
|
Returns a pixel value (index into the palette) for the given RGB values.
|
|
|
|
\wxheading{Parameters}
|
|
|
|
\docparam{red}{Red value.}
|
|
|
|
\docparam{green}{Green value.}
|
|
|
|
\docparam{blue}{Blue value.}
|
|
|
|
\wxheading{Return value}
|
|
|
|
The nearest palette index.
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
|
|
|
|
\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
|
|
|
|
\constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
|
|
\param{const unsigned char* }{blue}}
|
|
|
|
Returns RGB values for a given palette index.
|
|
|
|
\wxheading{Parameters}
|
|
|
|
\docparam{pixel}{The palette index.}
|
|
|
|
\docparam{red}{Receives the red value.}
|
|
|
|
\docparam{green}{Receives the green value.}
|
|
|
|
\docparam{blue}{Receives the blue value.}
|
|
|
|
\wxheading{Return value}
|
|
|
|
TRUE if the operation was successful.
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
|
|
|
|
\perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
|
|
returns a 3-element list ( or the empty list upon failure ).}
|
|
|
|
\membersection{wxPalette::Ok}\label{wxpaletteok}
|
|
|
|
\constfunc{bool}{Ok}{\void}
|
|
|
|
Returns TRUE if palette data is present.
|
|
|
|
\membersection{wxPalette::operator $=$}\label{wxpaletteassignment}
|
|
|
|
\func{wxPalette\&}{operator $=$}{\param{const wxPalette\& }{palette}}
|
|
|
|
Assignment operator, using reference counting. Returns a reference
|
|
to `this'.
|
|
|
|
\membersection{wxPalette::operator $==$}\label{wxpaletteequals}
|
|
|
|
\func{bool}{operator $==$}{\param{const wxPalette\& }{palette}}
|
|
|
|
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.
|
|
|
|
\membersection{wxPalette::operator $!=$}\label{wxpalettenotequals}
|
|
|
|
\func{bool}{operator $!=$}{\param{const wxPalette\& }{palette}}
|
|
|
|
Inequality operator. Two palettes are not equal if they contain pointers
|
|
to different underlying palette data. It does not compare each attribute.
|
|
|
|
|