00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef IMG_FILE_FILTER_CONVERT_H
00022 #define IMG_FILE_FILTER_CONVERT_H
00023
00024 class img_PlaneConvert;
00025
00026 #include <PXL/PXL_LumFuncs.h>
00027
00028 #include "IMG_FileFilter.h"
00029
00030 class IMG_API IMG_FileFilterConvert : public IMG_FileFilter
00031 {
00032 public:
00033 IMG_FileFilterConvert(IMG_File *file_to_filter);
00034 virtual ~IMG_FileFilterConvert();
00035
00036 virtual const char *className() const { return "IMG_FileFilterConvert"; }
00037
00038 void initConversion(IMG_DataType type,
00039 IMG_ColorModel model,
00040 bool interleaved,
00041 PXL_LumFunction func,
00042 bool splitoutalpha,
00043 const char *plane_name);
00044
00045 virtual const void *readPlaneScanline(int y, const IMG_Plane &pi);
00046
00047 virtual int writePlaneScanline(const void *data, int y,
00048 const IMG_Plane &pi);
00049 private:
00050 void convertPlane(int pindex,
00051 const IMG_Stat &sstat,
00052 bool sinterleave,
00053 IMG_Stat &dstat,
00054 bool dinterleave);
00055
00056 void convertData(void *dest, const void *source, int pindex, int y);
00057
00058 void splitAlphaFromColor(void *dest, const void *alpha, int pindex,
00059 bool reversed);
00060 void writeAlphaToColor(void *dest, const void *alpha, int pindex);
00061
00062 bool findAlphaPlane(const IMG_Stat &stat,int &aindex, int &acomp);
00063
00064 void initRead(IMG_DataType type,
00065 IMG_ColorModel model,
00066 bool interleaved,
00067 PXL_LumFunction func,
00068 bool splitoutalpha,
00069 const char *plane_name);
00070
00071 void initWrite(IMG_DataType type,
00072 IMG_ColorModel model,
00073 bool interleaved,
00074 PXL_LumFunction func,
00075 bool splitoutalpha,
00076 const char *plane_name);
00077
00078 UT_PtrArray<img_PlaneConvert *> myPlaneConvert;
00079 PXL_LumFunction myLumFunc;
00080 UT_IntArray myAlphaCombineFlags;
00081 };
00082
00083 #endif