#endif
#ifndef WX_PRECOMP
-#include "wx/wx.h"
#endif
#include "wx/image.h"
// 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;
else
delete[] data8bit;
+#if wxUSE_PALETTE
// Make a wxWindows palette
if (pPalette)
{
delete[] g;
delete[] b;
}
+#endif // wxUSE_PALETTE
return TRUE;
}
// 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 ( !Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags) )
+ return FALSE;
+
+#if wxUSE_PALETTE
+ if (palette)
{
- if (palette)
- {
- dest.SetPalette(* palette);
- delete palette;
- }
- return TRUE;
+ dest.SetPalette(* palette);
+ delete palette;
}
- else
- return FALSE;
+#endif // wxUSE_PALETTE
+
+ return TRUE;
}