1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxQuantize
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 Performs quantization, or colour reduction, on a wxImage.
13 Functions in this class are static and so a wxQuantize object need not be
19 class wxQuantize
: public wxObject
23 Constructor. You do not need to construct a wxQuantize object since its
29 Converts input bitmap(s) into 8bit representation with custom palette.
30 @a in_rows and @a out_rows are arrays [0..h-1] of pointer to rows
31 (@a in_rows contains @a w * 3 bytes per row, @a out_rows @a w bytes per row).
32 Fills @a out_rows with indexes into palette (which is also stored into @a palette
35 static void DoQuantize(unsigned int w
, unsigned int h
,
36 unsigned char** in_rows
, unsigned char** out_rows
,
37 unsigned char* palette
, int desiredNoColours
);
40 Reduce the colours in the source image and put the result into the destination image.
41 Both images may be the same, to overwrite the source image.
43 Specify an optional palette pointer to receive the resulting palette.
44 This palette may be passed to ConvertImageToBitmap, for example.
46 static bool Quantize(const wxImage
& src
, wxImage
& dest
,
47 wxPalette
** pPalette
, int desiredNoColours
= 236,
48 unsigned char** eightBitData
= 0,
49 int flags
= wxQUANTIZE_INCLUDE_WINDOWS_COLOURS
|
50 wxQUANTIZE_FILL_DESTINATION_IMAGE
|
51 wxQUANTIZE_RETURN_8BIT_DATA
);
54 This version sets a palette in the destination image so you don't
55 have to manage it yourself.
57 static bool Quantize(const wxImage
& src
, wxImage
& dest
,
58 int desiredNoColours
= 236,
59 unsigned char** eightBitData
= 0,
60 int flags
= wxQUANTIZE_INCLUDE_WINDOWS_COLOURS
|
61 wxQUANTIZE_FILL_DESTINATION_IMAGE
|
62 wxQUANTIZE_RETURN_8BIT_DATA
);