2005-10-06 10:37:43 -04:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%% Name: palette.tex
|
|
|
|
%% Purpose: wxPalette docs
|
|
|
|
%% Author:
|
|
|
|
%% Modified by:
|
|
|
|
%% Created:
|
|
|
|
%% RCS-ID: $Id$
|
|
|
|
%% Copyright: (c) wxWidgets
|
|
|
|
%% License: wxWindows license
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxPalette}}\label{wxpalette}
|
|
|
|
|
2006-09-24 06:27:12 -04:00
|
|
|
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. The notion of palettes is becoming more and more
|
|
|
|
obsolete nowadays and only the MSW port is still using a native palette.
|
|
|
|
All other ports use generic code which is basically just an array of
|
|
|
|
colours.
|
|
|
|
|
|
|
|
It is likely that in the future the only use for palettes within wxWidgets
|
|
|
|
will be for representing colour indeces from images (such as GIF or PNG).
|
|
|
|
The image handlers for these formats have been modified to create a palette
|
|
|
|
if there is such information in the original image file (usually 256 or less
|
|
|
|
colour images). See \helpref{wxImage}{wximage} for more information.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
1999-02-09 16:22:58 -05:00
|
|
|
%TODO: topic overview for wxPalette.
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxGDIObject}{wxgdiobject}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/palette.h>
|
|
|
|
|
1999-03-01 08:06:15 -05:00
|
|
|
\wxheading{Predefined objects}
|
|
|
|
|
|
|
|
Objects:
|
|
|
|
|
|
|
|
{\bf wxNullPalette}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxDC::SetPalette}{wxdcsetpalette}, \helpref{wxBitmap}{wxbitmap}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPalette::wxPalette}\label{wxpalettector}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{wxPalette}{\void}
|
|
|
|
|
|
|
|
Default constructor.
|
|
|
|
|
|
|
|
\func{}{wxPalette}{\param{const wxPalette\&}{ palette}}
|
|
|
|
|
|
|
|
Copy constructor. This uses reference counting so is a cheap operation.
|
|
|
|
|
1998-06-14 08:11:50 -04:00
|
|
|
\func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\
|
1998-05-20 10:25:30 -04:00
|
|
|
\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}
|
|
|
|
|
2001-04-14 15:46:05 -04:00
|
|
|
\perlnote{In wxPerl the third constructor form takes as parameters
|
|
|
|
3 array references ( they must be of the same length ).}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{\destruct{wxPalette}}{\void}
|
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
|
|
|
\membersection{wxPalette::Create}\label{wxpalettecreate}
|
|
|
|
|
1998-06-14 08:11:50 -04:00
|
|
|
\func{bool}{Create}{\param{int}{ n}, \param{const unsigned char* }{red},\rtfsp
|
1998-05-20 10:25:30 -04:00
|
|
|
\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}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
true if the creation was successful, false otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
2004-09-28 07:54:59 -04:00
|
|
|
\helpref{wxPalette::wxPalette}{wxpalettector}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-12-08 12:43:18 -05:00
|
|
|
\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount}
|
|
|
|
|
|
|
|
\constfunc{int}{GetColoursCount}{\void}
|
|
|
|
|
|
|
|
Returns number of entries in palette.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxPalette::GetPixel}\label{wxpalettegetpixel}
|
|
|
|
|
2005-10-06 10:37:43 -04:00
|
|
|
\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp
|
|
|
|
\param{unsigned char }{blue}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
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}
|
|
|
|
|
2005-10-06 10:37:43 -04:00
|
|
|
The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxPalette::GetRGB}{wxpalettegetrgb}
|
|
|
|
|
|
|
|
\membersection{wxPalette::GetRGB}\label{wxpalettegetrgb}
|
|
|
|
|
2005-02-19 19:07:35 -05:00
|
|
|
\constfunc{bool}{GetRGB}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp
|
1998-05-20 10:25:30 -04:00
|
|
|
\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}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
true if the operation was successful.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxPalette::GetPixel}{wxpalettegetpixel}
|
|
|
|
|
2001-04-14 15:46:05 -04:00
|
|
|
\perlnote{In wxPerl this method takes only the {\tt pixel} parameter and
|
|
|
|
returns a 3-element list ( or the empty list upon failure ).}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxPalette::Ok}\label{wxpaletteok}
|
|
|
|
|
|
|
|
\constfunc{bool}{Ok}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if palette data is present.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\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.
|