X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/954b8ae60391d18b87a604e7919c87c0c6ae208b..9e967d5417d49764276cf121a32c35d5770b1332:/docs/latex/wx/palette.tex diff --git a/docs/latex/wx/palette.tex b/docs/latex/wx/palette.tex index 5aeaa852fd..54015292e3 100644 --- a/docs/latex/wx/palette.tex +++ b/docs/latex/wx/palette.tex @@ -1,7 +1,28 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: palette.tex +%% Purpose: wxPalette docs +%% Author: +%% Modified by: +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxWidgets +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \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. +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. %TODO: topic overview for wxPalette. \wxheading{Derived from} @@ -13,13 +34,23 @@ of a low-depth bitmap, for example, to be mapped to the available colours in a d +\wxheading{Library} + +\helpref{wxCore}{librarieslist} + +\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} +\membersection{wxPalette::wxPalette}\label{wxpalettector} \func{}{wxPalette}{\void} @@ -27,7 +58,7 @@ Default constructor. \func{}{wxPalette}{\param{const wxPalette\&}{ palette}} -Copy constructor. This uses reference counting so is a cheap operation. +Copy constructor, uses \helpref{reference counting}{trefcount}. \func{}{wxPalette}{\param{int}{ n}, \param{const unsigned char* }{red},\\ \param{const unsigned char* }{green}, \param{const unsigned char* }{blue}} @@ -51,11 +82,15 @@ red, blue or green component. \helpref{wxPalette::Create}{wxpalettecreate} -\membersection{wxPalette::\destruct{wxPalette}} +\perlnote{In wxPerl the third constructor form takes as parameters + 3 array references ( they must be of the same length ).} + +\membersection{wxPalette::\destruct{wxPalette}}\label{wxpalettedtor} \func{}{\destruct{wxPalette}}{\void} Destructor. +See \helpref{reference-counted object destruction}{refcountdestruct} for more info. \membersection{wxPalette::Create}\label{wxpalettecreate} @@ -77,16 +112,22 @@ red, blue or green component. \wxheading{Return value} -TRUE if the creation was successful, FALSE otherwise. +true if the creation was successful, false otherwise. \wxheading{See also} -\helpref{wxPalette::wxPalette}{wxpaletteconstr} +\helpref{wxPalette::wxPalette}{wxpalettector} + +\membersection{wxPalette::GetColoursCount}\label{wxpalettegetcolourscount} + +\constfunc{int}{GetColoursCount}{\void} + +Returns number of entries in palette. \membersection{wxPalette::GetPixel}\label{wxpalettegetpixel} -\constfunc{int}{GetPixel}{\param{const unsigned char }{red}, \param{const unsigned char }{green},\rtfsp - \param{const unsigned char }{blue}} +\constfunc{int}{GetPixel}{\param{unsigned char }{red}, \param{unsigned char }{green},\rtfsp + \param{unsigned char }{blue}} Returns a pixel value (index into the palette) for the given RGB values. @@ -100,7 +141,7 @@ Returns a pixel value (index into the palette) for the given RGB values. \wxheading{Return value} -The nearest palette index. +The nearest palette index or {\tt wxNOT\_FOUND} for unexpected errors. \wxheading{See also} @@ -108,7 +149,7 @@ The nearest palette index. \membersection{wxPalette::GetRGB}\label{wxpalettegetrgb} -\constfunc{bool}{GetPixel}{\param{int}{ pixel}, \param{const unsigned char* }{red}, \param{const unsigned char* }{green},\rtfsp +\constfunc{bool}{GetRGB}{\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. @@ -125,39 +166,24 @@ Returns RGB values for a given palette index. \wxheading{Return value} -TRUE if the operation was successful. +true if the operation was successful. \wxheading{See also} \helpref{wxPalette::GetPixel}{wxpalettegetpixel} -\membersection{wxPalette::Ok}\label{wxpaletteok} +\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::IsOk}\label{wxpaletteisok} -\constfunc{bool}{Ok}{\void} +\constfunc{bool}{IsOk}{\void} -Returns TRUE if palette data is present. +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. - +Assignment operator, using \helpref{reference counting}{trefcount}.