// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows license
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "palette.h"
#endif
wxPalette::~wxPalette(void)
{
-// FreeResource(TRUE);
+// FreeResource(true);
}
bool wxPalette::FreeResource(bool WXUNUSED(force))
{
DeleteObject((HPALETTE)M_PALETTEDATA->m_hPalette);
}
- return TRUE;
+ return true;
}
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
UnRef();
-#if defined(__WXWINE__) || defined(__WXMICROWIN__)
+#if defined(__WXMICROWIN__)
- return (FALSE);
+ return false;
#else
NPLOGPALETTE npPal = (NPLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
(WORD)n * sizeof(PALETTEENTRY));
if (!npPal)
- return(FALSE);
+ return false;
npPal->palVersion = 0x300;
npPal->palNumEntries = n;
}
M_PALETTEDATA->m_hPalette = (WXHPALETTE) CreatePalette((LPLOGPALETTE)npPal);
LocalFree((HANDLE)npPal);
- return TRUE;
+ return true;
#endif
}
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
{
#ifdef __WXMICROWIN__
- return FALSE;
+ return 0;
#else
if ( !m_refData )
- return FALSE;
+ return 0;
return ::GetNearestPaletteIndex((HPALETTE) M_PALETTEDATA->m_hPalette, PALETTERGB(red, green, blue));
#endif
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
{
#ifdef __WXMICROWIN__
- return FALSE;
+ return false;
#else
if ( !m_refData )
- return FALSE;
+ return false;
if (index < 0 || index > 255)
- return FALSE;
+ return false;
PALETTEENTRY entry;
if (::GetPaletteEntries((HPALETTE) M_PALETTEDATA->m_hPalette, index, 1, &entry))
*red = entry.peRed;
*green = entry.peGreen;
*blue = entry.peBlue;
- return TRUE;
+ return true;
} else
- return FALSE;
+ return false;
#endif
}