X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45ef9db336f832840b500497a64615b47fdc272d..1978421a6d8b81c1f8a961da4b8ddf544fec7b1b:/src/generic/paletteg.cpp diff --git a/src/generic/paletteg.cpp b/src/generic/paletteg.cpp index edb0336210..7121430633 100644 --- a/src/generic/paletteg.cpp +++ b/src/generic/paletteg.cpp @@ -1,20 +1,28 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: palette.cpp +// Name: src/generic/paletteg.cpp // Purpose: // Author: Robert Roebling // Created: 01/02/97 // Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "paletteg.h" #endif -#include "wx/palette.h" +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) + #pragma hdrstop +#endif + +#if wxUSE_PALETTE +#include "wx/palette.h" //----------------------------------------------------------------------------- // wxPalette @@ -64,6 +72,7 @@ wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green } wxPalette::wxPalette(const wxPalette& palette) + : wxGDIObject() { Ref(palette); } @@ -96,13 +105,13 @@ bool wxPalette::Ok(void) const bool wxPalette::Create(int n, const unsigned char *red, - const unsigned char *green, + const unsigned char *green, const unsigned char *blue) { UnRef(); m_refData = new wxPaletteRefData(); - - M_PALETTEDATA->m_count = n; + + M_PALETTEDATA->m_count = n; M_PALETTEDATA->m_entries = new wxPaletteEntry[n]; wxPaletteEntry *e = M_PALETTEDATA->m_entries; @@ -122,8 +131,8 @@ int wxPalette::GetPixel( const unsigned char red, { if (!m_refData) return FALSE; - int closest = 0; - double d,distance = 1000.0; // max. dist is 256 + int closest = 0; + double d,distance = 1000.0; // max. dist is 256 wxPaletteEntry *e = M_PALETTEDATA->m_entries; for (int i = 0; i < M_PALETTEDATA->m_count; i++, e++) @@ -135,17 +144,17 @@ int wxPalette::GetPixel( const unsigned char red, closest = i; } } - return closest; + return closest; } -bool wxPalette::GetRGB(int pixel, +bool wxPalette::GetRGB(int pixel, unsigned char *red, - unsigned char *green, + unsigned char *green, unsigned char *blue) const { if (!m_refData) return FALSE; if (pixel >= M_PALETTEDATA->m_count) return FALSE; - + wxPaletteEntry& p = M_PALETTEDATA->m_entries[pixel]; if (red) *red = p.red; if (green) *green = p.green; @@ -153,4 +162,6 @@ bool wxPalette::GetRGB(int pixel, return TRUE; } +#endif // wxUSE_PALETTE +