]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/quantize.cpp
The mac text ctrl wants '/r' from the log system for line breaks.
[wxWidgets.git] / src / common / quantize.cpp
index 5f579ba9efd8dc71221186f5fe20606bbd6c14b8..d78882f6739e27365c3be94eac2a13192f755439 100644 (file)
 #include "wx/image.h"
 #include "wx/quantize.h"
 
 #include "wx/image.h"
 #include "wx/quantize.h"
 
+#ifdef __WXMSW__
+#include <windows.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
@@ -1562,3 +1566,23 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalett
     return TRUE;
 }
 
     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)
+{
+    wxPalette* palette = NULL;
+    if (Quantize(src, dest, & palette, desiredNoColours, eightBitData, flags))
+    {
+        if (palette)
+        {
+            dest.SetPalette(* palette);
+            delete palette;
+        }
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+