]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: quantize.h | |
e54c96f1 | 3 | // Purpose: interface of wxQuantize |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxQuantize | |
7c913512 | 11 | |
23324ae1 | 12 | Performs quantization, or colour reduction, on a wxImage. |
7c913512 | 13 | |
23324ae1 FM |
14 | Functions in this class are static and so a wxQuantize object need not be |
15 | created. | |
7c913512 | 16 | |
23324ae1 FM |
17 | @library{wxcore} |
18 | @category{misc} | |
19 | */ | |
20 | class wxQuantize : public wxObject | |
21 | { | |
22 | public: | |
23 | /** | |
24 | Constructor. You do not need to construct a wxQuantize object since its | |
25 | functions are static. | |
26 | */ | |
27 | wxQuantize(); | |
28 | ||
29 | /** | |
30 | Converts input bitmap(s) into 8bit representation with custom palette. | |
3ed3a1c8 BP |
31 | @a in_rows and @a out_rows are arrays [0..h-1] of pointer to rows |
32 | (@a in_rows contains @a w * 3 bytes per row, @a out_rows @a w bytes per row). | |
33 | Fills @a out_rows with indexes into palette (which is also stored into @a palette | |
23324ae1 FM |
34 | variable). |
35 | */ | |
36 | void DoQuantize(unsigned w, unsigned h, unsigned char** in_rows, | |
3ed3a1c8 | 37 | unsigned char** out_rows, unsigned char* palette, |
23324ae1 FM |
38 | int desiredNoColours); |
39 | ||
23324ae1 | 40 | /** |
3ed3a1c8 BP |
41 | Reduce the colours in the source image and put the result into the destination image. |
42 | Both images may be the same, to overwrite the source image. | |
43 | ||
44 | Specify an optional palette pointer to receive the resulting palette. | |
45 | This palette may be passed to ConvertImageToBitmap, for example. | |
23324ae1 FM |
46 | */ |
47 | bool Quantize(const wxImage& src, wxImage& dest, | |
3ed3a1c8 | 48 | wxPalette** pPalette, int desiredNoColours = 236, |
23324ae1 | 49 | unsigned char** eightBitData = 0, |
3ed3a1c8 BP |
50 | int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS |
51 | |wxQUANTIZE_FILL_DESTINATION_IMAGE | |
52 | |wxQUANTIZE_RETURN_8BIT_DATA); | |
53 | ||
54 | /** | |
55 | This version sets a palette in the destination image so you don't | |
56 | have to manage it yourself. | |
57 | */ | |
7c913512 FM |
58 | bool Quantize(const wxImage& src, wxImage& dest, |
59 | int desiredNoColours = 236, | |
60 | unsigned char** eightBitData = 0, | |
3ed3a1c8 BP |
61 | int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS |
62 | |wxQUANTIZE_FILL_DESTINATION_IMAGE | |
63 | |wxQUANTIZE_RETURN_8BIT_DATA); | |
23324ae1 | 64 | }; |
e54c96f1 | 65 |