]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: quantize.h | |
3 | // Purpose: interface of wxQuantize | |
4 | // Author: wxWidgets team | |
5 | // Licence: wxWindows licence | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
8 | /** | |
9 | @class wxQuantize | |
10 | ||
11 | Performs quantization, or colour reduction, on a wxImage. | |
12 | ||
13 | Functions in this class are static and so a wxQuantize object need not be | |
14 | created. | |
15 | ||
16 | @library{wxcore} | |
17 | @category{misc} | |
18 | */ | |
19 | class wxQuantize : public wxObject | |
20 | { | |
21 | public: | |
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. | |
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 | |
33 | variable). | |
34 | */ | |
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); | |
38 | ||
39 | /** | |
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. | |
45 | */ | |
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); | |
52 | ||
53 | /** | |
54 | This version sets a palette in the destination image so you don't | |
55 | have to manage it yourself. | |
56 | */ | |
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); | |
63 | }; | |
64 |