]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/quantize.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / interface / wx / quantize.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: quantize.h
e54c96f1 3// Purpose: interface of wxQuantize
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxQuantize
7c913512 10
23324ae1 11 Performs quantization, or colour reduction, on a wxImage.
7c913512 12
23324ae1
FM
13 Functions in this class are static and so a wxQuantize object need not be
14 created.
7c913512 15
23324ae1
FM
16 @library{wxcore}
17 @category{misc}
18*/
19class wxQuantize : public wxObject
20{
21public:
22 /**
23 Constructor. You do not need to construct a wxQuantize object since its
24 functions are static.
25 */
26 wxQuantize();
27
28 /**
29 Converts input bitmap(s) into 8bit representation with custom palette.
3ed3a1c8
BP
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
23324ae1
FM
33 variable).
34 */
43c48e1e
FM
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);
23324ae1 38
23324ae1 39 /**
3ed3a1c8
BP
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.
42
43 Specify an optional palette pointer to receive the resulting palette.
44 This palette may be passed to ConvertImageToBitmap, for example.
23324ae1 45 */
0004982c
FM
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);
3ed3a1c8
BP
52
53 /**
54 This version sets a palette in the destination image so you don't
55 have to manage it yourself.
56 */
0004982c
FM
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);
23324ae1 63};
e54c96f1 64