added wxUSE_PALETTE and fixed compilation with it set to 0

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-09-30 22:06:39 +00:00
parent f1c1831fc5
commit d275c7eb84
21 changed files with 227 additions and 101 deletions

View File

@@ -1483,8 +1483,11 @@ void wxQuantize::DoQuantize(unsigned w, unsigned h, unsigned char **in_rows, uns
// TODO: somehow make use of the Windows system colours, rather than ignoring them for the
// purposes of quantization.
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours,
unsigned char** eightBitData, int flags)
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest,
wxPalette** pPalette,
int desiredNoColours,
unsigned char** eightBitData,
int flags)
{
int i;
@@ -1559,6 +1562,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
else
delete[] data8bit;
#if wxUSE_PALETTE
// Make a wxWindows palette
if (pPalette)
{
@@ -1604,6 +1608,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
delete[] g;
delete[] b;
}
#endif // wxUSE_PALETTE
return TRUE;
}
@@ -1611,20 +1616,24 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
// This version sets a palette in the destination image so you don't
// have to manage it yourself.
bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, int desiredNoColours,
unsigned char** eightBitData, int flags)
bool wxQuantize::Quantize(const wxImage& src,
wxImage& dest,
int desiredNoColours,
unsigned char** eightBitData,
int flags)
{
wxPalette* palette = NULL;
if (Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags))
{
if (palette)
{
dest.SetPalette(* palette);
delete palette;
}
return TRUE;
}
else
if ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) )
return FALSE;
#if wxUSE_PALETTE
if (palette)
{
dest.SetPalette(* palette);
delete palette;
}
#endif // wxUSE_PALETTE
return TRUE;
}