X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/23324ae1c7938ba904770fc456d3c07764b9c5e9..3201a1046ba71ba8e5ef2ed694fde34d12f743f3:/interface/palette.h diff --git a/interface/palette.h b/interface/palette.h index b408669179..f1a9a4bdc0 100644 --- a/interface/palette.h +++ b/interface/palette.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: palette.h -// Purpose: documentation for wxPalette class +// Purpose: interface of wxPalette // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -9,88 +9,86 @@ /** @class wxPalette @wxheader{palette.h} - + 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. - + 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 wxImage for more information. - + @library{wxcore} @category{gdi} - + @stdobjects - Objects: - wxNullPalette - - @seealso - wxDC::SetPalette, wxBitmap + ::wxNullPalette + + @see wxDC::SetPalette(), wxBitmap */ class wxPalette : public wxGDIObject { public: - //@{ + /** - Creates a palette from arrays of size @e n, one for each - red, blue or green component. - - @param palette - A pointer or reference to the palette to copy. - - @param n - The number of indices in the palette. - - @param red - An array of red values. - - @param green - An array of green values. - - @param blue - An array of blue values. - - @sa Create() + Default constructor. */ wxPalette(); - wxPalette(const wxPalette& palette); - wxPalette(int n, const unsigned char* red, - const unsigned char* green, - const unsigned char* blue); - //@} + + /** + Copy constructor, uses @ref overview_refcount. + */ + wxPalette(const wxPalette& palette); + + /** + Creates a palette from arrays of size @a n, one for each red, blue or + green component. + + @param palette + A pointer or reference to the palette to copy. + @param n + The number of indices in the palette. + @param red + An array of red values. + @param green + An array of green values. + @param blue + An array of blue values. + + @see Create() + */ + wxPalette(int n, const unsigned char* red, + const unsigned char* green, + const unsigned char* blue); /** Destructor. - See @ref overview_refcountdestruct "reference-counted object destruction" for - more info. + + @see @ref overview_refcount_destruct "reference-counted object destruction" */ ~wxPalette(); /** - Creates a palette from arrays of size @e n, one for each - red, blue or green component. - - @param n - The number of indices in the palette. - - @param red - An array of red values. - - @param green - An array of green values. - - @param blue - An array of blue values. - - @returns @true if the creation was successful, @false otherwise. - - @sa wxPalette() + Creates a palette from arrays of size @a n, one for each red, blue or + green component. + + @param n + The number of indices in the palette. + @param red + An array of red values. + @param green + An array of green values. + @param blue + An array of blue values. + + @return @true if the creation was successful, @false otherwise. + + @see wxPalette() */ bool Create(int n, const unsigned char* red, const unsigned char* green, @@ -99,57 +97,60 @@ public: /** Returns number of entries in palette. */ - int GetColoursCount(); + int GetColoursCount() const; /** Returns a pixel value (index into the palette) for the given RGB values. - - @param red - Red value. - - @param green - Green value. - - @param blue - Blue value. - - @returns The nearest palette index or wxNOT_FOUND for unexpected errors. - - @sa GetRGB() + + @param red + Red value. + @param green + Green value. + @param blue + Blue value. + + @return The nearest palette index or @c wxNOT_FOUND for unexpected errors. + + @see GetRGB() */ int GetPixel(unsigned char red, unsigned char green, - unsigned char blue); + unsigned char blue) const; /** Returns RGB values for a given palette index. - - @param pixel - The palette index. - - @param red - Receives the red value. - - @param green - Receives the green value. - - @param blue - Receives the blue value. - - @returns @true if the operation was successful. - - @sa GetPixel() + + @param pixel + The palette index. + @param red + Receives the red value. + @param green + Receives the green value. + @param blue + Receives the blue value. + + @return @true if the operation was successful. + + @see GetPixel() */ -#define bool GetRGB(int pixel, const unsigned char* red, + bool GetRGB(int pixel, const unsigned char* red, const unsigned char* green, - const unsigned char* blue) /* implementation is private */ + const unsigned char* blue) const; /** Returns @true if palette data is present. */ -#define bool IsOk() /* implementation is private */ + bool IsOk() const; /** - Assignment operator, using @ref overview_trefcount "reference counting". + Assignment operator, using @ref overview_refcount. */ - wxPalette operator =(const wxPalette& palette); + wxPalette& operator =(const wxPalette& palette); }; + + +/** + An empty palette. +*/ +wxPalette wxNullPalette; + +