COLORQUANTIZER Class Reference
#include <mi32/colorquant.h>
List of all members.
Public Types |
| enum | DITHER { DITHER_None,
DITHER_FloydSteinberg
} |
| enum | REPRESENTATIVE { REPRESENTATIVE_Center,
REPRESENTATIVE_AverageColor,
REPRESENTATIVE_AveragePixel
} |
Public Member Functions |
| | COLORQUANTIZER () |
| virtual | ~COLORQUANTIZER () |
| ERRVALUE | ComputePalette (COLOR_ARRAY &Palette) |
| ERRVALUE | Convert (const COLOR_ARRAY &Palette) |
| ERRVALUE | Convert () |
| int | GetMaxColors () const |
| ERRVALUE | GetSourceMaskRow (INT32 row, const UINT8 *&pMaskRow) |
| ERRVALUE | GetSourceRow (INT32 row, const void *&pImageRow, const UINT8 *&pMaskRow) |
| ERRVALUE | GetSourceSampleRow (INT32 row, UINT16 SampleNum, const UINT8 *&pImageRow) |
| bool | IsSampleContiguous () |
| void | SetDither (DITHER dither) |
| void | SetMaxColors (int MaxColors) |
| void | SetMaxPrecision (int MaxPrecision) |
| void | SetRepresentative (REPRESENTATIVE representative) |
| void | SetShowStatus (bool bShowStatus) |
Private Member Functions |
| virtual ERRVALUE | v_EndTargetRow (INT32 row) |
| virtual INT32 | v_GetNumColumns ()=0 |
| virtual INT32 | v_GetNumRows ()=0 |
| virtual COLORSPACE | v_GetSourceColorspace ()=0 |
| virtual ERRVALUE | v_GetSourceMaskRow (INT32 row, const UINT8 *&pMaskRow) |
| virtual ERRVALUE | v_GetSourceRow (INT32 row, const void *&pImageRow, const UINT8 *&pMaskRow)=0 |
| virtual ERRVALUE | v_GetSourceSampleRow (INT32 row, UINT16 SampleNum, const UINT8 *&pImageRow) |
| virtual ERRVALUE | v_GetTargetRow (INT32 row, UINT8 *&pImageRow) |
| virtual bool | v_IsSampleContiguous () |
| virtual ERRVALUE | v_PutTargetPalette (COLOR_ARRAY &palette) |
Member Enumeration Documentation
- Enumerator:
| DITHER_None |
|
| DITHER_FloydSteinberg |
|
- Enumerator:
| REPRESENTATIVE_Center |
|
| REPRESENTATIVE_AverageColor |
|
| REPRESENTATIVE_AveragePixel |
|
Constructor & Destructor Documentation
| COLORQUANTIZER::COLORQUANTIZER |
( |
|
) |
|
| virtual COLORQUANTIZER::~COLORQUANTIZER |
( |
|
) |
[virtual] |
Member Function Documentation
Compute color palette only.
- Parameters:
-
Compute palette and perform conversion.
- Parameters:
-
Compute palette and perform conversion.
| int COLORQUANTIZER::GetMaxColors |
( |
|
) |
const [inline] |
Get maximum number of output colors.
- Parameters:
-
| row | Image row number |
| pMaskRow | Pointer to start of mask row returned, NULL if no mask |
| ERRVALUE COLORQUANTIZER::GetSourceRow |
( |
INT32 |
row, |
|
|
const void *& |
pImageRow, |
|
|
const UINT8 *& |
pMaskRow | |
|
) |
| | [inline] |
- Parameters:
-
| row | Image row number |
| pImageRow | Pointer to start of image row returned |
| pMaskRow | Pointer to start of mask row returned, NULL if no mask |
- Parameters:
-
| row | Image row number |
| SampleNum | Sample number |
| pImageRow | Pointer to start of image row returned |
| bool COLORQUANTIZER::IsSampleContiguous |
( |
|
) |
[inline] |
Called to check if samples are contiguous.
| void COLORQUANTIZER::SetDither |
( |
DITHER |
dither |
) |
[inline] |
Set dither method.
Default is Floyd-Steinberg if not previously set.
| void COLORQUANTIZER::SetMaxColors |
( |
int |
MaxColors |
) |
[inline] |
Set maximum number of palette colors to generate.
Default is 256 if not set.
- Parameters:
-
| MaxColors | Maximum number of palette colors to generate |
| void COLORQUANTIZER::SetMaxPrecision |
( |
int |
MaxPrecision |
) |
[inline] |
Set maximum precision for representing color.
Default precision is 8 bits per component if not set. When determining the color usage, a count of each unique RGBA value is determined, up to a maximum of 32K unique values. If the number of unique values exceeds this maximum the precision is reduced and the source image is scanned again. If it is known in advance that the number of unique values may be large, time may be saved by starting with a lower precision value. Recommendation is to use 6 or 7 bits if source based on a pictorial image (eg photo or satellite) and 8 bits if source is based on a graphical drawing (eg vector, shape, etc).
- Parameters:
-
| MaxPrecision | Maximum precision per component, must be between 4 and 8 |
| void COLORQUANTIZER::SetRepresentative |
( |
REPRESENTATIVE |
representative |
) |
[inline] |
Set method for determining representative color.
Default is AverageColor if not set.
| void COLORQUANTIZER::SetShowStatus |
( |
bool |
bShowStatus |
) |
[inline] |
Set whether to show status context updates.
| virtual ERRVALUE COLORQUANTIZER::v_EndTargetRow |
( |
INT32 |
row |
) |
[private, virtual] |
Called at end of each target image row.
Default implementation does nothing.
- Parameters:
-
| virtual INT32 COLORQUANTIZER::v_GetNumColumns |
( |
|
) |
[private, pure virtual] |
Get number of columns in image.
| virtual INT32 COLORQUANTIZER::v_GetNumRows |
( |
|
) |
[private, pure virtual] |
Get number of rows in image.
| virtual COLORSPACE COLORQUANTIZER::v_GetSourceColorspace |
( |
|
) |
[private, pure virtual] |
Get source image colorspace.
Must return one of RGB or RGBA colorspace variants in any supported ordering.
| virtual ERRVALUE COLORQUANTIZER::v_GetSourceMaskRow |
( |
INT32 |
row, |
|
|
const UINT8 *& |
pMaskRow | |
|
) |
| | [private, virtual] |
Called to get pointers to source mask rows.
- Parameters:
-
| row | Image row number |
| pMaskRow | Pointer to start of mask row returned, return NULL if no mask |
| virtual ERRVALUE COLORQUANTIZER::v_GetSourceRow |
( |
INT32 |
row, |
|
|
const void *& |
pImageRow, |
|
|
const UINT8 *& |
pMaskRow | |
|
) |
| | [private, pure virtual] |
Called to get pointers to source image and mask rows.
- Parameters:
-
| row | Image row number |
| pImageRow | Pointer to start of image row returned |
| pMaskRow | Pointer to start of mask row returned, return NULL if no mask |
| virtual ERRVALUE COLORQUANTIZER::v_GetSourceSampleRow |
( |
INT32 |
row, |
|
|
UINT16 |
SampleNum, |
|
|
const UINT8 *& |
pImageRow | |
|
) |
| | [private, virtual] |
Called to get pointers to source image and mask rows.
- Parameters:
-
| row | Image row number |
| SampleNum | Sample number |
| pImageRow | Pointer to start of image row returned |
| virtual ERRVALUE COLORQUANTIZER::v_GetTargetRow |
( |
INT32 |
row, |
|
|
UINT8 *& |
pImageRow | |
|
) |
| | [private, virtual] |
Called to get pointer to target image row.
Default implementation returns EProgramError.
- Parameters:
-
| row | Image row number |
| pImageRow | Pointer to start of image row returned |
| virtual bool COLORQUANTIZER::v_IsSampleContiguous |
( |
|
) |
[private, virtual] |
Called to check if samples are contiguous.
Default implementation returns false.
| virtual ERRVALUE COLORQUANTIZER::v_PutTargetPalette |
( |
COLOR_ARRAY & |
palette |
) |
[private, virtual] |
Called when target palette has been computed.
Override may modify palette as needed. Default implementation returns EProgramError.
- Parameters:
-
| palette | Palette passed/returned |
The documentation for this class was generated from the following file: