00001
00030 #ifndef INC_MI32_COLORQUANT_H
00031 #define INC_MI32_COLORQUANT_H
00032
00033 #ifndef INC_MI32_COLORSPC_H
00034 #include <mi32/colorspc.h>
00035 #endif
00036
00037 class COLOR_ARRAY;
00038
00039
00040 class COLORQUANTIZER {
00041 public:
00042
00043 enum DITHER {
00044 DITHER_None,
00045 DITHER_FloydSteinberg
00046
00047 };
00048
00049 enum REPRESENTATIVE {
00050 REPRESENTATIVE_Center,
00051 REPRESENTATIVE_AverageColor,
00052 REPRESENTATIVE_AveragePixel
00053 };
00054
00055 COLORQUANTIZER ();
00056
00057 virtual ~COLORQUANTIZER ();
00058
00060 ERRVALUE ComputePalette (
00061 COLOR_ARRAY& Palette
00062 );
00063
00065 ERRVALUE Convert (
00066 );
00067
00069 ERRVALUE Convert (
00070 const COLOR_ARRAY& Palette
00071 );
00072
00074 int GetMaxColors (
00075 ) const { return (m_MaxColors); }
00076
00079 void SetDither (
00080 DITHER dither
00081 ) { m_dither = dither; }
00082
00085 void SetMaxColors (
00086 int MaxColors
00087 ) { if (MaxColors > 1 && MaxColors <= 256) m_MaxColors = MaxColors; }
00088
00097 void SetMaxPrecision (
00098 int MaxPrecision
00099 ) { m_MaxPrecision = MaxPrecision; }
00100
00103 void SetRepresentative (
00104 REPRESENTATIVE representative
00105 ) { m_representative = representative; }
00106
00108 void SetShowStatus (
00109 bool bShowStatus
00110 ) { m_bShowStatus = bShowStatus; }
00111
00112
00113 ERRVALUE GetSourceRow (
00114 INT32 row,
00115 const void *& pImageRow,
00116 const UINT8 *& pMaskRow
00117 ) { return (v_GetSourceRow(row,pImageRow,pMaskRow)); }
00118
00119
00120 ERRVALUE GetSourceSampleRow (
00121 INT32 row,
00122 UINT16 SampleNum,
00123 const UINT8 *& pImageRow
00124 ) { return (v_GetSourceSampleRow(row,SampleNum,pImageRow)); }
00125
00126
00127 ERRVALUE GetSourceMaskRow (
00128 INT32 row,
00129 const UINT8 *& pMaskRow
00130 ) { return (v_GetSourceMaskRow(row,pMaskRow)); }
00131
00133 bool IsSampleContiguous (
00134 ) { return (v_IsSampleContiguous()); }
00135
00136 private:
00137 #ifndef GENERATING_DOXYGEN_OUTPUT
00138 DITHER m_dither;
00139 REPRESENTATIVE m_representative;
00140 int m_MaxColors;
00141 int m_MaxPrecision;
00142 bool m_bShowStatus;
00143 #endif // GENERATING_DOXYGEN_OUTPUT
00144
00145
00146
00149 virtual ERRVALUE v_EndTargetRow (
00150 INT32 row
00151 );
00152
00154 virtual INT32 v_GetNumColumns (
00155 ) = 0;
00156
00158 virtual INT32 v_GetNumRows (
00159 ) = 0;
00160
00163 virtual COLORSPACE v_GetSourceColorspace (
00164 ) = 0;
00165
00167 virtual ERRVALUE v_GetSourceRow (
00168 INT32 row,
00169 const void *& pImageRow,
00170 const UINT8 *& pMaskRow
00171 ) = 0;
00172
00174 virtual ERRVALUE v_GetSourceMaskRow (
00175 INT32 row,
00176 const UINT8 *& pMaskRow
00177 );
00178
00180 virtual ERRVALUE v_GetSourceSampleRow (
00181 INT32 row,
00182 UINT16 SampleNum,
00183 const UINT8 *& pImageRow
00184 );
00185
00188 virtual bool v_IsSampleContiguous (
00189 );
00190
00193 virtual ERRVALUE v_GetTargetRow (
00194 INT32 row,
00195 UINT8 *& pImageRow
00196 );
00197
00201 virtual ERRVALUE v_PutTargetPalette (
00202 COLOR_ARRAY& palette
00203 );
00204 };
00205
00206 #endif