CxImage学习

官方下载地址是:http://www.xdp.it/cximage/

 

打开工程后可以看到下例这些工程:

- CxImage

- CxImageCrtDll

- CxImageMfcDll

- dome

- domeDll

- jasper

- jbig

- jpeg

- libdcr

- mng

- png

- tiff

- zlib

 

1。首先我们要确定在程序中是希望静态链接还是动态链接,在这里我建议大家使用动态链接,因为这个库有点大,如果使用静态链接的话你的应用程序体积会额外增加1MB多。

 

2。然后确定在MFC中使用还是在CRT环境中使用,这个库专门为你建了这两个工程来创建不同环境中使用的运行时库,跟据你的需求来选择编译CxImageCrtDll还是CxImageMfcDll工程,如果你希望使用静态库链接的话除了这两个工程不需要编译其它的工程都需要编译。并且在引用这个静态库的时候要把这些所有编译过的工程里的*.lib全部拷到你的程里去。

 

3。OK编译完工程后将以下文件拷到你建立的工程里去

先将头文件拷到你的工程里去:

xfile.h、ximacfg.h、ximadef.h、ximage.h、xiofile.h、xmemfile.h

 

使用静态链接需要拷以下文件:

cximage.lib、png.lib、Jpeg.lib、jbig.lib、Tiff.lib、libdcr.lib、jasper.lib、zlib.lib、mng.lib

 

如用动态链接需要拷以下文件:

cximage.lib、cximage.dll

 

4。在你的工程里引用这个库#include "ximage.h"、#pragma comment(lib, "cximage.lib")如果是静态链接拷过来的那些*.lib文件全部要引用进去否则无法链接,在这里有人可能会问既然只包含了"ximage.h"这一个头文件为什么要拷那么多头文件过来呢?这是因为"ximage.h"这个头文件依赖那几个头文件所以必须拷过来。

 

5。现在你就可以使用这个CxImage库了,那我们来加载一幅图片然后将它显示出来吧:

      CxImage  image; // 定义一个CxImage对象

 

      image.Load("Ooopsy.png", CXIMAGE_FORMAT_PNG); // 加载一幅png图片

 

      // 在OnPaint消息里显示出来

      image.Draw(dc.GetSafeHdc(), 0, 0);

 

     以上只介绍最简单的用法,至于基它的功能你就自已尝试,我就不多说了,要是我一下子说完了CxImage开发者就不需要写文档说明了,在它的跟目录下有一个index.htm这就是它的文档起始页,如果你需要的话就自已去看吧!

 

 

 

具体应用技巧

1、打开一张图
可以通过创建一个新的CxImage对象来完成,通过构造函数来打开一张图
CxImage::CxImage(const char * filename, DWORD imagetype)
其中filename是需要打开的文件路径,imagetype是文件类型,支持的类型有:
CXIMAGE_FORMAT_UNKNOWN,CXIMAGE_FORMAT_BMP,CXIMAGE_FORMAT_GIF,CXIMAGE_FORMAT_JPG,CXIMAGE_FORMAT_PNG,CXIMAGE_FORMAT_MNG,CXIMAGE_FORMAT_ICO,CXIMAGE_FORMAT_TIF,CXIMAGE_FORMAT_TGA,CXIMAGE_FORMAT_PCX,CXIMAGE_FORMAT_WBMP,CXIMAGE_FORMAT_WMF,CXIMAGE_FORMAT_J2K,CXIMAGE_FORMAT_JBG,CXIMAGE_FORMAT_JP2,CXIMAGE_FORMAT_JPC,CXIMAGE_FORMAT_PGX,CXIMAGE_FORMAT_PNM,CXIMAGE_FORMAT_RAS,
当然,这么多格式很难记住,我们可以通过如下函数来直接获得文件的格式。
int FindType(const CString& filename)
{
 CString ext = filename.Right(filename.GetLength()-filename.ReverseFind('.')-1);
 int type = 0;
 if (ext == "bmp")     type = CXIMAGE_FORMAT_BMP;
#if CXIMAGE_SUPPORT_JPG
 else if (ext=="jpg"||ext=="jpeg") type = CXIMAGE_FORMAT_JPG;
#endif
#if CXIMAGE_SUPPORT_GIF
 else if (ext == "gif")    type = CXIMAGE_FORMAT_GIF;
#endif
#if CXIMAGE_SUPPORT_PNG
 else if (ext == "png")    type = CXIMAGE_FORMAT_PNG;
#endif
#if CXIMAGE_SUPPORT_MNG
 else if (ext=="mng"||ext=="jng") type = CXIMAGE_FORMAT_MNG;
#endif
#if CXIMAGE_SUPPORT_ICO
 else if (ext == "ico")    type = CXIMAGE_FORMAT_ICO;
#endif
#if CXIMAGE_SUPPORT_TIF
 else if (ext=="tiff"||ext=="tif") type = CXIMAGE_FORMAT_TIF;
#endif
#if CXIMAGE_SUPPORT_TGA
 else if (ext=="tga")    type = CXIMAGE_FORMAT_TGA;
#endif
#if CXIMAGE_SUPPORT_PCX
 else if (ext=="pcx")    type = CXIMAGE_FORMAT_PCX;
#endif
#if CXIMAGE_SUPPORT_WBMP
 else if (ext=="wbmp")    type = CXIMAGE_FORMAT_WBMP;
#endif
#if CXIMAGE_SUPPORT_WMF
 else if (ext=="wmf"||ext=="emf") type = CXIMAGE_FORMAT_WMF;
#endif
#if CXIMAGE_SUPPORT_J2K
 else if (ext=="j2k"||ext=="jp2") type = CXIMAGE_FORMAT_J2K;
#endif
#if CXIMAGE_SUPPORT_JBG
 else if (ext=="jbg")    type = CXIMAGE_FORMAT_JBG;
#endif
#if CXIMAGE_SUPPORT_JP2
 else if (ext=="jp2"||ext=="j2k") type = CXIMAGE_FORMAT_JP2;
#endif
#if CXIMAGE_SUPPORT_JPC
 else if (ext=="jpc"||ext=="j2c") type = CXIMAGE_FORMAT_JPC;
#endif
#if CXIMAGE_SUPPORT_PGX
 else if (ext=="pgx")    type = CXIMAGE_FORMAT_PGX;
#endif
#if CXIMAGE_SUPPORT_RAS
 else if (ext=="ras")    type = CXIMAGE_FORMAT_RAS;
#endif
#if CXIMAGE_SUPPORT_PNM
 else if (ext=="pnm"||ext=="pgm"||ext=="ppm") type = CXIMAGE_FORMAT_PNM;
#endif
 else type = CXIMAGE_FORMAT_UNKNOWN;
 
 return type;
}

2、保存一张图
bool CxImage::Save(LPCWSTR filename, DWORD imagetype=0)
参数和上面是一样的。
3、得到图形数据,以便在OpenGL中使用材质
 BYTE* CxImage::GetBits(DWORD row = 0);
4、得到图形大小
long GetSize();
5、得到图形高度和宽度
 DWORD CxImage::GetHeight();
 DWORD CxImage::GetWidth();
6、得到文件类型
 DWORD CxImage::GetType()  const;
7、得到最后一个错误
 char* CxImage::GetLastError();
8、在界面中绘制出来
long CxImage::Draw(HDC hdc, const RECT& rect, RECT* pClipRect=NULL)
HDC 绘图设备,rect 绘图的区域,确定绘图的左上角和右下角坐标。pClipRect,裁剪区域,一般可以和绘图区域一样大小,除非特殊需要。

 

    

CxImage类库是一个优秀的图像操作类库。它可以快捷地存取、显示、转换各种图像。有的读者可能说,有那么多优秀的图形库,如OpenIL,FreeImage,PaintLib等等,它们可谓是功能强大,齐全,没必要用其它的类库。但我要说,这些类库基本上没有免费的,使用这些类库,你要被这样那样的许可协议所束缚。在这点上,CxImage类库是完全免费的。另外,在使用上述类库时,你会遇到重重麻烦。因为它们大部分是平台无关的,且用C语言写成,有的还夹杂着基本的C++ wrapper和成堆德编译选项的声明需要你去处理。而CxImage类库在这方面做得很好。还有让我最看好的,就是作者完全公开了源代码。相对于那些封装好的图形库和GDI+来说,这一点使我们可以进一步学习各种编解码技术,而不再浮于各种技术的表面。 CxImage类库的结构:

CxImage学习_第1张图片

 

一个CxImage对象是一个扩展了的位图。作者只是在位图结构上添加了一些起存储信息作用的成员变量。一个CxImage对象(同时)也是一组层。每个层只有在需要时才会分配相应的缓冲区。CxImage::pDib代表着背景图像,CxImage::pAlpha代表着透明层,CxImage::pSelection代表着被选中的层,被用来创建图像处理时让用户感兴趣的区域。在这三个特殊层面的基础上,你可以增加一些额外的层,这些层可以存储在CxImage::pLayers中。一般说来,层是一个完整的CxImage对象。因此,你可以构造很复杂的嵌套层。下面是CxImage的一些成员变量:

 

class DLL_EXP CxImage { //extensible information collector typedef struct tagCxImageInfo { DWORD dwEffWidth; //DWORD aligned scan line width BYTE* pImage; //THE IMAGE BITS CxImage* pGhost; //if this is a ghost, pGhost points to the body CxImage* pParent; //if this is a layer, pParent points to the body DWORD dwType; //original image format char szLastError[256]; //debugging long nProgress; //monitor long nEscape; //escape long nBkgndIndex; //used for GIF, PNG, MNG RGBQUAD nBkgndColor; //used for RGB transparency BYTE nQuality; //used for JPEG long nFrame; //used for TIF, GIF, MNG : actual frame long nNumFrames; //used for TIF, GIF, MNG : total number of frames DWORD dwFrameDelay; //used for GIF, MNG long xDPI; //horizontal resolution long yDPI; //vertical resolution RECT rSelectionBox; //bounding rectangle BYTE nAlphaMax; //max opacity (fade) bool bAlphaPaletteEnabled; //true if alpha values in the palette are enabled. bool bEnabled; //enables the painting functions long xOffset; long yOffset; DWORD dwEncodeOption; //for GIF, TIF : 0=def.1=unc,2=fax3,3=fax4,4=pack,5=jpg RGBQUAD last_c; //for GetNearestIndex optimization BYTE last_c_index; bool last_c_isvalid; long nNumLayers; DWORD dwFlags; // 0x??00000 = reserved, 0x00??0000 = blend mode, 0x0000???? = layer id - user flags } CXIMAGEINFO; public: //constructors CxImage(DWORD imagetype = 0); CxImage(DWORD dwWidth, DWORD dwHeight, DWORD wBpp, DWORD imagetype = 0); CxImage(const CxImage &src, bool copypixels = true, bool copyselection = true, bool copyalpha = true); CxImage(const char * filename, DWORD imagetype); CxImage(FILE * stream, DWORD imagetype); CxImage(CxFile * stream, DWORD imagetype); CxImage(BYTE * buffer, DWORD size, DWORD imagetype); virtual ~CxImage() { Destroy(); }; CxImage& operator = (const CxImage&); //initializzation void* Create(DWORD dwWidth, DWORD dwHeight, DWORD wBpp, DWORD imagetype = 0); void Destroy(); void Clear(BYTE bval=0); void Copy(const CxImage &src, bool copypixels = true, bool copyselection = true, bool copyalpha = true); void Transfer(CxImage &from); bool CreateFromArray(BYTE* pArray,DWORD dwWidth,DWORD dwHeight,DWORD dwBitsperpixel, DWORD dwBytesperline, bool bFlipImage); bool CreateFromMatrix(BYTE** ppMatrix,DWORD dwWidth,DWORD dwHeight,DWORD dwBitsperpixel, DWORD dwBytesperline, bool bFlipImage); //Attributes long GetSize(); BYTE* GetBits(DWORD row = 0); BYTE GetColorType(); void* GetDIB() const {return pDib;} DWORD GetHeight() const {return head.biHeight;} DWORD GetWidth() const {return head.biWidth;} DWORD GetEffWidth() const {return info.dwEffWidth;} DWORD GetNumColors() const {return head.biClrUsed;} WORD GetBpp() const {return head.biBitCount;} DWORD GetType() const {return info.dwType;} char* GetLastError() {return info.szLastError;} const char* GetVersion(); DWORD GetFrameDelay() const {return info.dwFrameDelay;} void SetFrameDelay(DWORD d) {info.dwFrameDelay=d;} void GetOffset(long *x,long *y) {*x=info.xOffset; *y=info.yOffset;} void SetOffset(long x,long y) {info.xOffset=x; info.yOffset=y;} BYTE GetJpegQuality() const {return info.nQuality;} void SetJpegQuality(BYTE q) {info.nQuality = q;} long GetXDPI() const {return info.xDPI;} long GetYDPI() const {return info.yDPI;} void SetXDPI(long dpi); void SetYDPI(long dpi); DWORD GetClrImportant() const {return head.biClrImportant;} void SetClrImportant(DWORD ncolors = 0); long GetProgress() const {return info.nProgress;} long GetEscape() const {return info.nEscape;} void SetProgress(long p) {info.nProgress = p;} void SetEscape(long i) {info.nEscape = i;} long GetTransIndex() const {return info.nBkgndIndex;} RGBQUAD GetTransColor(); void SetTransIndex(long idx) {info.nBkgndIndex = idx;} void SetTransColor(RGBQUAD rgb) {rgb.rgbReserved=0; info.nBkgndColor = rgb;} bool IsTransparent() const {return info.nBkgndIndex>=0;} // <vho> DWORD GetEncodeOption() const {return info.dwEncodeOption;} void SetEncodeOption(DWORD opt) {info.dwEncodeOption = opt;} DWORD GetFlags() const {return info.dwFlags;} void SetFlags(DWORD flags, bool bLockReservedFlags = true); //void* GetUserData() const {return info.pUserData;} //void SetUserData(void* pUserData) {info.pUserData = pUserData;} //palette operations bool IsGrayScale(); bool IsIndexed() {return head.biClrUsed!=0;} DWORD GetPaletteSize(); RGBQUAD* GetPalette() const; RGBQUAD GetPaletteColor(BYTE idx); bool GetPaletteColor(BYTE i, BYTE* r, BYTE* g, BYTE* b); BYTE GetNearestIndex(RGBQUAD c); void BlendPalette(COLORREF cr,long perc); void SetGrayPalette(); void SetPalette(DWORD n, BYTE *r, BYTE *g, BYTE *b); void SetPalette(RGBQUAD* pPal,DWORD nColors=256); void SetPalette(rgb_color *rgb,DWORD nColors=256); void SetPaletteColor(BYTE idx, BYTE r, BYTE g, BYTE b, BYTE alpha=0); void SetPaletteColor(BYTE idx, RGBQUAD c); void SetPaletteColor(BYTE idx, COLORREF cr); void SwapIndex(BYTE idx1, BYTE idx2); void SetStdPalette(); //pixel operations bool IsInside(long x, long y); bool IsTransparent(long x,long y); RGBQUAD GetPixelColor(long x,long y); BYTE GetPixelIndex(long x,long y); BYTE GetPixelGray(long x, long y); void SetPixelColor(long x,long y,RGBQUAD c, bool bEditAlpha = false); void SetPixelColor(long x,long y,COLORREF cr); void SetPixelIndex(long x,long y,BYTE i); void DrawLine(int StartX, int EndX, int StartY, int EndY, RGBQUAD color, bool bEditAlpha=false); void DrawLine(int StartX, int EndX, int StartY, int EndY, COLORREF cr); //painting operations #if CXIMAGE_SUPPORT_WINCE long Blt(HDC pDC, long x=0, long y=0); #endif #if CXIMAGE_SUPPORT_WINDOWS HBITMAP MakeBitmap(HDC hdc = NULL); HANDLE CopyToHandle(); bool CreateFromHANDLE(HANDLE hMem); //Windows objects (clipboard) void CreateFromHBITMAP(HBITMAP hbmp, HPALETTE hpal=0); //Windows resource void CreateFromHICON(HICON hico); long Draw(HDC hdc, long x=0, long y=0, long cx = -1, long cy = -1, RECT* pClipRect = 0); long Draw(HDC hdc, const RECT& rect, RECT* pClipRect=NULL) { return Draw(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, pClipRect); } long Stretch(HDC hdc, long xoffset, long yoffset, long xsize, long ysize); long Stretch(HDC hdc, const RECT& rect) { return Stretch(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } long Tile(HDC hdc, RECT *rc); long Draw2(HDC hdc, long x=0, long y=0, long cx = -1, long cy = -1); long Draw2(HDC hdc, const RECT& rect) { return Draw2(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } long DrawText(HDC hdc, long x, long y, const char* text, RGBQUAD color, const char* font, long lSize=0, long lWeight=400, BYTE bItalic=0, BYTE bUnderline=0, bool bEditAlpha=false); #endif //CXIMAGE_SUPPORT_WINDOWS // file operations #if CXIMAGE_SUPPORT_DECODE #ifdef WIN32 bool Load(LPCWSTR filename, DWORD imagetype=0); bool LoadResource(HRSRC hRes, DWORD imagetype, HMODULE hModule=NULL); #endif bool Load(const char * filename, DWORD imagetype=0); bool Decode(FILE * hFile, DWORD imagetype); bool Decode(CxFile * hFile, DWORD imagetype); bool Decode(BYTE * buffer, DWORD size, DWORD imagetype); #endif //CXIMAGE_SUPPORT_DECODE #if CXIMAGE_SUPPORT_ENCODE #ifdef WIN32 bool Save(LPCWSTR filename, DWORD imagetype=0); #endif bool Save(const char * filename, DWORD imagetype=0); bool Encode(FILE * hFile, DWORD imagetype); bool Encode(CxFile * hFile, DWORD imagetype); bool Encode(CxFile * hFile, CxImage ** pImages, int pagecount, DWORD imagetype); bool Encode(FILE *hFile, CxImage ** pImages, int pagecount, DWORD imagetype); bool Encode(BYTE * &buffer, long &size, DWORD imagetype); #endif //CXIMAGE_SUPPORT_ENCODE //misc. bool IsValid() const {return pDib!=0;} bool IsEnabled() const {return info.bEnabled;} void Enable(bool enable=true){info.bEnabled=enable;} // frame operations long GetNumFrames() const {return info.nNumFrames;} long GetFrame() const {return info.nFrame;} void SetFrame(long nFrame) {info.nFrame=nFrame;} #if CXIMAGE_SUPPORT_BASICTRANSFORMATIONS bool GrayScale(); bool Flip(); bool Mirror(); bool Negative(); bool RotateLeft(CxImage* iDst = NULL); bool RotateRight(CxImage* iDst = NULL); #endif //CXIMAGE_SUPPORT_BASICTRANSFORMATIONS #if CXIMAGE_SUPPORT_TRANSFORMATION // image operations bool Rotate(float angle, CxImage* iDst = NULL); bool Rotate180(CxImage* iDst = NULL); bool Resample(long newx, long newy, int mode = 1, CxImage* iDst = NULL); bool DecreaseBpp(DWORD nbit, bool errordiffusion, RGBQUAD* ppal = 0, DWORD clrimportant = 0); bool IncreaseBpp(DWORD nbit); bool Dither(long method = 0); bool Crop(long left, long top, long right, long bottom, CxImage* iDst = NULL); bool Crop(const RECT& rect, CxImage* iDst = NULL) { return Crop(rect.left, rect.top, rect.right, rect.bottom, iDst); } bool Skew(float xgain, float ygain, long xpivot=0, long ypivot=0); bool Expand(long left, long top, long right, long bottom, RGBQUAD canvascolor, CxImage* iDst = 0); bool Expand(long newx, long newy, RGBQUAD canvascolor, CxImage* iDst = 0); bool Thumbnail(long newx, long newy, RGBQUAD canvascolor, CxImage* iDst = 0); protected: float b3spline(float x); public: #endif //CXIMAGE_SUPPORT_TRANSFORMATION #if CXIMAGE_SUPPORT_DSP bool Contour(); bool HistogramStretch(); bool HistogramEqualize(); bool HistogramNormalize(); bool HistogramRoot(); bool HistogramLog(); long Histogram(long* red, long* green = 0, long* blue = 0, long* gray = 0, long colorspace = 0); bool Jitter(long radius=2); bool Repair(float radius = 0.25f, long niterations = 1, long colorspace = 0); bool Combine(CxImage* r,CxImage* g,CxImage* b,CxImage* a, long colorspace = 0); bool FFT2(CxImage* srcReal, CxImage* srcImag, CxImage* dstReal, CxImage* dstImag, long direction = 1, bool bForceFFT = true, bool bMagnitude = true); bool Noise(long level); bool Median(long Ksize=3); bool Gamma(float gamma); bool ShiftRGB(long r, long g, long b); bool Threshold(BYTE level); bool Colorize(BYTE hue, BYTE sat); bool Light(long brightness, long contrast = 0); float Mean(); bool Filter(long* kernel, long Ksize, long Kfactor, long Koffset); bool Erode(long Ksize=2); bool Dilate(long Ksize=2); void HuePalette(float correction=1); enum ImageOpType { OpAdd, OpAnd, OpXor, OpOr, OpMask, OpSrcCopy, OpDstCopy, OpSub, OpSrcBlend }; void Mix(CxImage & imgsrc2, ImageOpType op, long lXOffset = 0, long lYOffset = 0); protected: bool IsPowerof2(long x); bool FFT(int dir,int m,double *x,double *y); bool DFT(int dir,long m,double *x1,double *y1,double *x2,double *y2); bool RepairChannel(CxImage *ch, float radius); public: //color conversion utilities bool SplitRGB(CxImage* r,CxImage* g,CxImage* b); bool SplitYUV(CxImage* y,CxImage* u,CxImage* v); bool SplitHSL(CxImage* h,CxImage* s,CxImage* l); bool SplitYIQ(CxImage* y,CxImage* i,CxImage* q); bool SplitXYZ(CxImage* x,CxImage* y,CxImage* z); bool SplitCMYK(CxImage* c,CxImage* m,CxImage* y,CxImage* k); RGBQUAD HSLtoRGB(COLORREF cHSLColor); RGBQUAD RGBtoHSL(RGBQUAD lRGBColor); RGBQUAD HSLtoRGB(RGBQUAD lHSLColor); RGBQUAD YUVtoRGB(RGBQUAD lYUVColor); RGBQUAD RGBtoYUV(RGBQUAD lRGBColor); RGBQUAD YIQtoRGB(RGBQUAD lYIQColor); RGBQUAD RGBtoYIQ(RGBQUAD lRGBColor); RGBQUAD XYZtoRGB(RGBQUAD lXYZColor); RGBQUAD RGBtoXYZ(RGBQUAD lRGBColor); #endif //CXIMAGE_SUPPORT_DSP RGBQUAD RGBtoRGBQUAD(COLORREF cr); COLORREF RGBQUADtoRGB (RGBQUAD c); #if CXIMAGE_SUPPORT_SELECTION //selection bool SelectionClear(); bool SelectionCreate(); bool SelectionDelete(); bool SelectionInvert(); bool SelectionAddRect(RECT r); bool SelectionAddEllipse(RECT r); bool SelectionAddPolygon(POINT *points, long npoints); bool SelectionAddColor(RGBQUAD c); bool SelectionAddPixel(int x, int y); bool SelectionCopy(CxImage &from); bool SelectionIsInside(long x, long y); bool SelectionIsValid(){return pSelection!=0;} void SelectionGetBox(RECT& r){memcpy(&r,&info.rSelectionBox,sizeof(RECT));} bool SelectionToHRGN(HRGN& region); #endif //CXIMAGE_SUPPORT_SELECTION #if CXIMAGE_SUPPORT_ALPHA //Alpha void AlphaClear(); void AlphaCreate(); void AlphaDelete(); void AlphaInvert(); bool AlphaMirror(); bool AlphaFlip(); bool AlphaCopy(CxImage &from); bool AlphaSplit(CxImage *dest); void AlphaStrip(); void AlphaSet(BYTE level); bool AlphaSet(CxImage &from); void AlphaSet(long x,long y,BYTE level); BYTE AlphaGet(long x,long y); BYTE AlphaGetMax() const {return info.nAlphaMax;} void AlphaSetMax(BYTE nAlphaMax) {info.nAlphaMax=nAlphaMax;} bool AlphaIsValid(){return pAlpha!=0;} BYTE* AlphaGetBits() const {return pAlpha;} void AlphaPaletteClear(); void AlphaPaletteEnable(bool enable=true){info.bAlphaPaletteEnabled=enable;} bool AlphaPaletteIsEnabled(){return info.bAlphaPaletteEnabled;} bool AlphaPaletteIsValid(); bool AlphaPaletteSplit(CxImage *dest); #endif //CXIMAGE_SUPPORT_ALPHA #if CXIMAGE_SUPPORT_LAYERS bool LayerCreate(long position = -1); bool LayerDelete(long position = -1); void LayerDeleteAll(); CxImage* GetLayer(long position); CxImage* GetParent() const {return info.pParent;} long GetNumLayers() const {return info.nNumLayers;} #endif //CXIMAGE_SUPPORT_LAYERS protected: void Startup(DWORD imagetype = 0); void CopyInfo(const CxImage &src); void Ghost(CxImage *src); void RGBtoBGR(BYTE *buffer, int length); float HueToRGB(float n1,float n2, float hue); void Bitfield2RGB(BYTE *src, WORD redmask, WORD greenmask, WORD bluemask, BYTE bpp); static int CompareColors(const void *elem1, const void *elem2); bool EncodeSafeCheck(CxFile *hFile); void* pDib; //contains the header, the palette, the pixels BITMAPINFOHEADER head; //standard header CXIMAGEINFO info; //extended information BYTE* pSelection; //selected region BYTE* pAlpha; //alpha channel CxImage** pLayers; //generic layers };

你可能感兴趣的:(image,ext,null,buffer,float,byte)