]> Creatis software - clitk.git/blobdiff - utilities/CxImage/ximainfo.cpp
cosmetic
[clitk.git] / utilities / CxImage / ximainfo.cpp
index fd453f2f778e22b485d8b9ea68d654f377237fbc..28cbad40cc42b11e9f9b7585af9fecd88bdf3314 100644 (file)
-// ximainfo.cpp : main attributes\r
-/* 03/10/2004 v1.00 - Davide Pizzolato - www.xdp.it\r
- * CxImage version 6.0.0 02/Feb/2008\r
- */\r
-\r
-#include "ximage.h"\r
-\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return the color used for transparency, and/or for background color\r
- */\r
-RGBQUAD        CxImage::GetTransColor()\r
-{\r
-       if (head.biBitCount<24 && info.nBkgndIndex>=0) return GetPaletteColor((BYTE)info.nBkgndIndex);\r
-       return info.nBkgndColor;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Gets the index used for transparency. Returns -1 for no transparancy.\r
- */\r
-long CxImage::GetTransIndex() const\r
-{\r
-       return info.nBkgndIndex;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Sets the index used for transparency with 1, 4 and 8 bpp images. Set to -1 to remove the effect.\r
- */\r
-void CxImage::SetTransIndex(long idx)\r
-{\r
-       if (idx<(long)head.biClrUsed)\r
-               info.nBkgndIndex = idx;\r
-       else \r
-               info.nBkgndIndex = 0;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Sets the color used for transparency with 24 bpp images.\r
- * You must call SetTransIndex(0) to enable the effect, SetTransIndex(-1) to disable it.\r
- */\r
-void CxImage::SetTransColor(RGBQUAD rgb)\r
-{\r
-       rgb.rgbReserved=0;\r
-       info.nBkgndColor = rgb;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-bool CxImage::IsTransparent() const\r
-{\r
-       return info.nBkgndIndex>=0; // <vho>\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Returns true if the image has 256 colors or less.\r
- */\r
-bool CxImage::IsIndexed() const\r
-{\r
-       return head.biClrUsed!=0;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return 1 = indexed, 2 = RGB, 4 = RGBA\r
- */\r
-BYTE CxImage::GetColorType()\r
-{\r
-       BYTE b = (BYTE)((head.biBitCount>8) ? 2 /*COLORTYPE_COLOR*/ : 1 /*COLORTYPE_PALETTE*/);\r
-#if CXIMAGE_SUPPORT_ALPHA\r
-       if (AlphaIsValid()) b = 4 /*COLORTYPE_ALPHA*/;\r
-#endif //CXIMAGE_SUPPORT_ALPHA\r
-       return b;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return Resolution for TIFF, JPEG, PNG and BMP formats.\r
- */\r
-long CxImage::GetXDPI() const\r
-{\r
-       return info.xDPI;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return Resolution for TIFF, JPEG, PNG and BMP formats.\r
- */\r
-long CxImage::GetYDPI() const\r
-{\r
-       return info.yDPI;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Set resolution for TIFF, JPEG, PNG and BMP formats.\r
- */\r
-void CxImage::SetXDPI(long dpi)\r
-{\r
-       if (dpi<=0) dpi = CXIMAGE_DEFAULT_DPI;\r
-       info.xDPI = dpi;\r
-       head.biXPelsPerMeter = (long) floor(dpi * 10000.0 / 254.0 + 0.5);\r
-       if (pDib) ((BITMAPINFOHEADER*)pDib)->biXPelsPerMeter = head.biXPelsPerMeter;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Set resolution for TIFF, JPEG, PNG and BMP formats.\r
- */\r
-void CxImage::SetYDPI(long dpi)\r
-{\r
-       if (dpi<=0) dpi = CXIMAGE_DEFAULT_DPI;\r
-       info.yDPI = dpi;\r
-       head.biYPelsPerMeter = (long) floor(dpi * 10000.0 / 254.0 + 0.5);\r
-       if (pDib) ((BITMAPINFOHEADER*)pDib)->biYPelsPerMeter = head.biYPelsPerMeter;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \sa SetFlags\r
- */\r
-DWORD CxImage::GetFlags() const\r
-{\r
-       return info.dwFlags;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Image flags, for future use\r
- * \param flags\r
- *  - 0x??00000 = reserved for 16 bit, CMYK, multilayer\r
- *  - 0x00??0000 = blend modes\r
- *  - 0x0000???? = layer id or user flags\r
- *\r
- * \param bLockReservedFlags protects the "reserved" and "blend modes" flags \r
- */\r
-void CxImage::SetFlags(DWORD flags, bool bLockReservedFlags)\r
-{\r
-       if (bLockReservedFlags) info.dwFlags = flags & 0x0000ffff;\r
-       else info.dwFlags = flags;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \sa SetCodecOption\r
- */\r
-DWORD CxImage::GetCodecOption(DWORD imagetype)\r
-{\r
-       imagetype = GetTypeIndexFromId(imagetype);\r
-       if (imagetype==0){\r
-               imagetype = GetTypeIndexFromId(GetType());\r
-       }\r
-       return info.dwCodecOpt[imagetype];\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Encode option for GIF, TIF and JPG.\r
- * - GIF : 0 = LZW (default), 1 = none, 2 = RLE.\r
- * - TIF : 0 = automatic (default), or a valid compression code as defined in "tiff.h" (COMPRESSION_NONE = 1, COMPRESSION_CCITTRLE = 2, ...)\r
- * - JPG : valid values stored in enum CODEC_OPTION ( ENCODE_BASELINE = 0x01, ENCODE_PROGRESSIVE = 0x10, ...)\r
- * - RAW : valid values stored in enum CODEC_OPTION ( DECODE_QUALITY_LIN = 0x00, DECODE_QUALITY_VNG = 0x01, ...)\r
- *\r
- * \return true if everything is ok\r
- */\r
-bool CxImage::SetCodecOption(DWORD opt, DWORD imagetype)\r
-{\r
-       imagetype = GetTypeIndexFromId(imagetype);\r
-       if (imagetype==0){\r
-               imagetype = GetTypeIndexFromId(GetType());\r
-       }\r
-       info.dwCodecOpt[imagetype] = opt;\r
-       return true;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return internal hDib object..\r
- */\r
-void* CxImage::GetDIB() const\r
-{\r
-       return pDib;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetHeight() const\r
-{\r
-       return head.biHeight;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetWidth() const\r
-{\r
-       return head.biWidth;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return DWORD aligned width of the image.\r
- */\r
-DWORD CxImage::GetEffWidth() const\r
-{\r
-       return info.dwEffWidth;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return 2, 16, 256; 0 for RGB images.\r
- */\r
-DWORD CxImage::GetNumColors() const\r
-{\r
-       return head.biClrUsed;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return: 1, 4, 8, 24.\r
- */\r
-WORD CxImage::GetBpp() const\r
-{\r
-       return head.biBitCount;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return original image format\r
- * \sa ENUM_CXIMAGE_FORMATS.\r
- */\r
-DWORD CxImage::GetType() const\r
-{\r
-       return info.dwType;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * change image format identifier\r
- * \sa ENUM_CXIMAGE_FORMATS.\r
- */\r
-bool CxImage::SetType(DWORD type)\r
-{\r
-       switch (type){\r
-#if CXIMAGE_SUPPORT_BMP\r
-       case CXIMAGE_FORMAT_BMP:\r
-#endif\r
-#if CXIMAGE_SUPPORT_GIF\r
-       case CXIMAGE_FORMAT_GIF:\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPG\r
-       case CXIMAGE_FORMAT_JPG:\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNG\r
-       case CXIMAGE_FORMAT_PNG:\r
-#endif\r
-#if CXIMAGE_SUPPORT_MNG\r
-       case CXIMAGE_FORMAT_MNG:\r
-#endif\r
-#if CXIMAGE_SUPPORT_ICO\r
-       case CXIMAGE_FORMAT_ICO:\r
-#endif\r
-#if CXIMAGE_SUPPORT_TIF\r
-       case CXIMAGE_FORMAT_TIF:\r
-#endif\r
-#if CXIMAGE_SUPPORT_TGA\r
-       case CXIMAGE_FORMAT_TGA:\r
-#endif\r
-#if CXIMAGE_SUPPORT_PCX\r
-       case CXIMAGE_FORMAT_PCX:\r
-#endif\r
-#if CXIMAGE_SUPPORT_WBMP\r
-       case CXIMAGE_FORMAT_WBMP:\r
-#endif\r
-#if CXIMAGE_SUPPORT_WMF\r
-       case CXIMAGE_FORMAT_WMF:\r
-#endif\r
-#if CXIMAGE_SUPPORT_JBG\r
-       case CXIMAGE_FORMAT_JBG:\r
-#endif\r
-#if CXIMAGE_SUPPORT_JP2\r
-       case CXIMAGE_FORMAT_JP2:\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPC\r
-       case CXIMAGE_FORMAT_JPC:\r
-#endif\r
-#if CXIMAGE_SUPPORT_PGX\r
-       case CXIMAGE_FORMAT_PGX:\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNM\r
-       case CXIMAGE_FORMAT_PNM:\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAS\r
-       case CXIMAGE_FORMAT_RAS:\r
-#endif\r
-#if CXIMAGE_SUPPORT_SKA\r
-       case CXIMAGE_FORMAT_SKA:\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAW\r
-       case CXIMAGE_FORMAT_RAW:\r
-#endif\r
-               info.dwType = type;\r
-               return true;\r
-       }\r
-       info.dwType = CXIMAGE_FORMAT_UNKNOWN;\r
-       return false;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetNumTypes()\r
-{\r
-       return CMAX_IMAGE_FORMATS-1;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetTypeIdFromName(const TCHAR* ext)\r
-{\r
-#if CXIMAGE_SUPPORT_BMP\r
-       if (_tcsnicmp(ext,_T("bmp"),3)==0 )             return CXIMAGE_FORMAT_BMP;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPG\r
-       if (_tcsnicmp(ext,_T("jpg"),3)==0 ||\r
-               _tcsnicmp(ext,_T("jpe"),3)==0 ||\r
-               _tcsnicmp(ext,_T("jfi"),3)==0 )         return CXIMAGE_FORMAT_JPG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_GIF\r
-       if (_tcsnicmp(ext,_T("gif"),3)==0 )             return CXIMAGE_FORMAT_GIF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNG\r
-       if (_tcsnicmp(ext,_T("png"),3)==0 )             return CXIMAGE_FORMAT_PNG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_ICO\r
-       if (_tcsnicmp(ext,_T("ico"),3)==0 ||\r
-               _tcsnicmp(ext,_T("cur"),3)==0 )         return CXIMAGE_FORMAT_ICO;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TIF\r
-       if (_tcsnicmp(ext,_T("tif"),3)==0 )             return CXIMAGE_FORMAT_TIF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TGA\r
-       if (_tcsnicmp(ext,_T("tga"),3)==0 )             return CXIMAGE_FORMAT_TGA;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PCX\r
-       if (_tcsnicmp(ext,_T("pcx"),3)==0 )             return CXIMAGE_FORMAT_PCX;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WBMP\r
-       if (_tcsnicmp(ext,_T("wbm"),3)==0 )             return CXIMAGE_FORMAT_WBMP;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WMF\r
-       if (_tcsnicmp(ext,_T("wmf"),3)==0 ||\r
-               _tcsnicmp(ext,_T("emf"),3)==0 )         return CXIMAGE_FORMAT_WMF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JP2\r
-       if (_tcsnicmp(ext,_T("jp2"),3)==0 ||\r
-               _tcsnicmp(ext,_T("j2k"),3)==0 )         return CXIMAGE_FORMAT_JP2;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPC\r
-       if (_tcsnicmp(ext,_T("jpc"),3)==0 ||\r
-               _tcsnicmp(ext,_T("j2c"),3)==0 )         return CXIMAGE_FORMAT_JPC;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PGX\r
-       if (_tcsnicmp(ext,_T("pgx"),3)==0 )             return CXIMAGE_FORMAT_PGX;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAS\r
-       if (_tcsnicmp(ext,_T("ras"),3)==0 )             return CXIMAGE_FORMAT_RAS;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNM\r
-       if (_tcsnicmp(ext,_T("pnm"),3)==0 ||\r
-               _tcsnicmp(ext,_T("pgm"),3)==0 ||\r
-               _tcsnicmp(ext,_T("ppm"),3)==0 )         return CXIMAGE_FORMAT_PNM;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JBG\r
-       if (_tcsnicmp(ext,_T("jbg"),3)==0 )             return CXIMAGE_FORMAT_JBG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_MNG\r
-       if (_tcsnicmp(ext,_T("mng"),3)==0 ||\r
-               _tcsnicmp(ext,_T("jng"),3)==0 )         return CXIMAGE_FORMAT_MNG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_SKA\r
-       if (_tcsnicmp(ext,_T("ska"),3)==0 )             return CXIMAGE_FORMAT_SKA;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAW\r
-       if (_tcsnicmp(ext,_T("nef"),3)==0 ||\r
-               _tcsnicmp(ext,_T("crw"),3)==0 ||\r
-               _tcsnicmp(ext,_T("cr2"),3)==0 ||\r
-               _tcsnicmp(ext,_T("dng"),3)==0 ||\r
-               _tcsnicmp(ext,_T("arw"),3)==0 ||\r
-               _tcsnicmp(ext,_T("erf"),3)==0 ||\r
-               _tcsnicmp(ext,_T("3fr"),3)==0 ||\r
-               _tcsnicmp(ext,_T("dcr"),3)==0 ||\r
-               _tcsnicmp(ext,_T("raw"),3)==0 ||\r
-               _tcsnicmp(ext,_T("x3f"),3)==0 ||\r
-               _tcsnicmp(ext,_T("mef"),3)==0 ||\r
-               _tcsnicmp(ext,_T("raf"),3)==0 ||\r
-               _tcsnicmp(ext,_T("mrw"),3)==0 ||\r
-               _tcsnicmp(ext,_T("pef"),3)==0 ||\r
-               _tcsnicmp(ext,_T("sr2"),3)==0 ||\r
-               _tcsnicmp(ext,_T("orf"),3)==0 )         return CXIMAGE_FORMAT_RAW;\r
-#endif\r
-\r
-       return CXIMAGE_FORMAT_UNKNOWN;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetTypeIdFromIndex(const DWORD index)\r
-{\r
-       DWORD n;\r
-\r
-       n=0; if (index == n) return CXIMAGE_FORMAT_UNKNOWN;\r
-#if CXIMAGE_SUPPORT_BMP\r
-       n++; if (index == n) return CXIMAGE_FORMAT_BMP;\r
-#endif\r
-#if CXIMAGE_SUPPORT_GIF\r
-       n++; if (index == n) return CXIMAGE_FORMAT_GIF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPG\r
-       n++; if (index == n) return CXIMAGE_FORMAT_JPG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNG\r
-       n++; if (index == n) return CXIMAGE_FORMAT_PNG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_ICO\r
-       n++; if (index == n) return CXIMAGE_FORMAT_ICO;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TIF\r
-       n++; if (index == n) return CXIMAGE_FORMAT_TIF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TGA\r
-       n++; if (index == n) return CXIMAGE_FORMAT_TGA;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PCX\r
-       n++; if (index == n) return CXIMAGE_FORMAT_PCX;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WBMP\r
-       n++; if (index == n) return CXIMAGE_FORMAT_WBMP;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WMF\r
-       n++; if (index == n) return CXIMAGE_FORMAT_WMF;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JP2\r
-       n++; if (index == n) return CXIMAGE_FORMAT_JP2;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPC\r
-       n++; if (index == n) return CXIMAGE_FORMAT_JPC;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PGX\r
-       n++; if (index == n) return CXIMAGE_FORMAT_PGX;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNM\r
-       n++; if (index == n) return CXIMAGE_FORMAT_PNM;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAS\r
-       n++; if (index == n) return CXIMAGE_FORMAT_RAS;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JBG\r
-       n++; if (index == n) return CXIMAGE_FORMAT_JBG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_MNG\r
-       n++; if (index == n) return CXIMAGE_FORMAT_MNG;\r
-#endif\r
-#if CXIMAGE_SUPPORT_SKA\r
-       n++; if (index == n) return CXIMAGE_FORMAT_SKA;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAW\r
-       n++; if (index == n) return CXIMAGE_FORMAT_RAW;\r
-#endif\r
-\r
-       return CXIMAGE_FORMAT_UNKNOWN;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::GetTypeIndexFromId(const DWORD id)\r
-{\r
-       DWORD n;\r
-\r
-       n=0; if (id == CXIMAGE_FORMAT_UNKNOWN) return n;\r
-#if CXIMAGE_SUPPORT_BMP\r
-       n++; if (id == CXIMAGE_FORMAT_BMP) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_GIF\r
-       n++; if (id == CXIMAGE_FORMAT_GIF) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPG\r
-       n++; if (id == CXIMAGE_FORMAT_JPG) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNG\r
-       n++; if (id == CXIMAGE_FORMAT_PNG) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_ICO\r
-       n++; if (id == CXIMAGE_FORMAT_ICO) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TIF\r
-       n++; if (id == CXIMAGE_FORMAT_TIF) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_TGA\r
-       n++; if (id == CXIMAGE_FORMAT_TGA) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PCX\r
-       n++; if (id == CXIMAGE_FORMAT_PCX) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WBMP\r
-       n++; if (id == CXIMAGE_FORMAT_WBMP) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_WMF\r
-       n++; if (id == CXIMAGE_FORMAT_WMF) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JP2\r
-       n++; if (id == CXIMAGE_FORMAT_JP2) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JPC\r
-       n++; if (id == CXIMAGE_FORMAT_JPC) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PGX\r
-       n++; if (id == CXIMAGE_FORMAT_PGX) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_PNM\r
-       n++; if (id == CXIMAGE_FORMAT_PNM) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAS\r
-       n++; if (id == CXIMAGE_FORMAT_RAS) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_JBG\r
-       n++; if (id == CXIMAGE_FORMAT_JBG) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_MNG\r
-       n++; if (id == CXIMAGE_FORMAT_MNG) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_SKA\r
-       n++; if (id == CXIMAGE_FORMAT_SKA) return n;\r
-#endif\r
-#if CXIMAGE_SUPPORT_RAW\r
-       n++; if (id == CXIMAGE_FORMAT_RAW) return n;\r
-#endif\r
-\r
-       return 0;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return current frame delay in milliseconds. Only for GIF and MNG formats.\r
- */\r
-DWORD CxImage::GetFrameDelay() const\r
-{\r
-       return info.dwFrameDelay;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Sets current frame delay. Only for GIF format.\r
- * \param d = delay in milliseconds\r
- */\r
-void CxImage::SetFrameDelay(DWORD d)\r
-{\r
-       info.dwFrameDelay=d;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-void CxImage::GetOffset(long *x,long *y)\r
-{\r
-       *x=info.xOffset;\r
-       *y=info.yOffset;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-void CxImage::SetOffset(long x,long y)\r
-{\r
-       info.xOffset=x;\r
-       info.yOffset=y;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \sa SetJpegQuality, GetJpegQualityF\r
- * \author [DP]; changes [Stefan Schürmans]\r
- */\r
-BYTE CxImage::GetJpegQuality() const\r
-{\r
-       return (BYTE)(info.fQuality + 0.5f);\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \sa SetJpegQuality, GetJpegQuality\r
- * \author [Stefan Schürmans]\r
- */\r
-float CxImage::GetJpegQualityF() const\r
-{\r
-       return info.fQuality;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * quality level for JPEG and JPEG2000\r
- * \param q: can be from 0 to 100\r
- * \author [DP]; changes [Stefan Schürmans]\r
- */\r
-void CxImage::SetJpegQuality(BYTE q){\r
-       info.fQuality = (float)q;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * quality level for JPEG and JPEG2000\r
- * necessary for JPEG2000 when quality is between 0.0 and 1.0\r
- * \param q: can be from 0.0 to 100.0\r
- * \author [Stefan Schürmans]\r
- */\r
-void CxImage::SetJpegQualityF(float q){\r
-       if (q>0) info.fQuality = q;\r
-       else  info.fQuality = 0.0f;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \sa SetJpegScale\r
- */\r
-BYTE CxImage::GetJpegScale() const\r
-{\r
-       return info.nJpegScale;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * scaling down during JPEG decoding valid numbers are 1, 2, 4, 8\r
- * \author [ignacio]\r
- */\r
-void CxImage::SetJpegScale(BYTE q){\r
-       info.nJpegScale = q;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Used to monitor the slow loops.\r
- * \return value is from 0 to 100.\r
- * \sa SetProgress\r
- */\r
-long CxImage::GetProgress() const\r
-{\r
-       return info.nProgress;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return the escape code.\r
- * \sa SetEscape\r
- */\r
-long CxImage::GetEscape() const\r
-{\r
-       return info.nEscape;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Forces the value of the internal progress variable.\r
- * \param p should be from 0 to 100.\r
- * \sa GetProgress\r
- */\r
-void CxImage::SetProgress(long p)\r
-{\r
-       info.nProgress = p;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Used to quit the slow loops or the codecs.\r
- * - SetEscape(-1) before Decode forces the function to exit, right after  \r
- *   the image width and height are available ( for bmp, jpg, gif, tif )\r
- */\r
-void CxImage::SetEscape(long i)\r
-{\r
-       info.nEscape = i;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Checks if the image is correctly initializated.\r
- */\r
-bool CxImage::IsValid() const\r
-{\r
-       return pDib!=0;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * True if the image is enabled for painting.\r
- */\r
-bool CxImage::IsEnabled() const\r
-{\r
-       return info.bEnabled;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Enables/disables the image.\r
- */\r
-void CxImage::Enable(bool enable)\r
-{\r
-       info.bEnabled=enable;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * This function must be used after a Decode() / Load() call.\r
- * Use the sequence SetFrame(-1); Load(...); GetNumFrames();\r
- * to get the number of images without loading the first image.\r
- * \return the number of images in the file.\r
- */\r
-long CxImage::GetNumFrames() const\r
-{\r
-       return info.nNumFrames;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return the current selected image (zero-based index).\r
- */\r
-long CxImage::GetFrame() const\r
-{\r
-       return info.nFrame;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Sets the image number that the next Decode() / Load() call will load\r
- */\r
-void CxImage::SetFrame(long nFrame){\r
-       info.nFrame=nFrame;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Sets the method for drawing the frame related to others\r
- * \sa GetDisposalMethod\r
- */\r
-void CxImage::SetDisposalMethod(BYTE dm)\r
-{      info.dispmeth=dm; }\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Gets the method for drawing the frame related to others\r
- * Values :    0 -   No disposal specified. The decoder is\r
- *                   not required to take any action.\r
- *             1 -   Do not dispose. The graphic is to be left\r
- *                   in place.\r
- *             2 -   Restore to background color. The area used by the\r
- *                   graphic must be restored to the background color.\r
- *             3 -   Restore to previous. The decoder is required to\r
- *                   restore the area overwritten by the graphic with\r
- *                   what was there prior to rendering the graphic.\r
- *             4-7 -    To be defined.\r
- */\r
-BYTE CxImage::GetDisposalMethod() const\r
-{      return info.dispmeth; }\r
-////////////////////////////////////////////////////////////////////////////////\r
-bool CxImage::GetRetreiveAllFrames() const\r
-{      return info.bGetAllFrames; }\r
-////////////////////////////////////////////////////////////////////////////////\r
-void CxImage::SetRetreiveAllFrames(bool flag)\r
-{      info.bGetAllFrames = flag; }\r
-////////////////////////////////////////////////////////////////////////////////\r
-CxImage * CxImage::GetFrame(long nFrame) const\r
-{\r
-       if ( ppFrames == NULL) return NULL;\r
-       if ( info.nNumFrames == 0) return NULL;\r
-       if ( nFrame >= info.nNumFrames ) return NULL;\r
-       if ( nFrame < 0) nFrame = info.nNumFrames - 1;\r
-       return ppFrames[nFrame];\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-short CxImage::ntohs(const short word)\r
-{\r
-       if (info.bLittleEndianHost) return word;\r
-       return ( (word & 0xff) << 8 ) | ( (word >> 8) & 0xff );\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-long CxImage::ntohl(const long dword)\r
-{\r
-       if (info.bLittleEndianHost) return dword;\r
-       return  ((dword & 0xff) << 24 ) | ((dword & 0xff00) << 8 ) |\r
-                       ((dword >> 8) & 0xff00) | ((dword >> 24) & 0xff);\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-void CxImage::bihtoh(BITMAPINFOHEADER* bih)\r
-{\r
-       bih->biSize = ntohl(bih->biSize);\r
-       bih->biWidth = ntohl(bih->biWidth);\r
-       bih->biHeight = ntohl(bih->biHeight);\r
-       bih->biPlanes = ntohs(bih->biPlanes);\r
-       bih->biBitCount = ntohs(bih->biBitCount);\r
-       bih->biCompression = ntohl(bih->biCompression);\r
-       bih->biSizeImage = ntohl(bih->biSizeImage);\r
-       bih->biXPelsPerMeter = ntohl(bih->biXPelsPerMeter);\r
-       bih->biYPelsPerMeter = ntohl(bih->biYPelsPerMeter);\r
-       bih->biClrUsed = ntohl(bih->biClrUsed);\r
-       bih->biClrImportant = ntohl(bih->biClrImportant);\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * Returns the last reported error.\r
- */\r
-const char* CxImage::GetLastError()\r
-{\r
-       return info.szLastError;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::DumpSize()\r
-{\r
-       DWORD n;\r
-       n = sizeof(BITMAPINFOHEADER) + sizeof(CXIMAGEINFO) + GetSize();\r
-\r
-       if (pAlpha){\r
-               n += 1 + head.biWidth * head.biHeight;\r
-       } else n++;\r
-\r
-       if (pSelection){\r
-               n += 1 + head.biWidth * head.biHeight;\r
-       } else n++;\r
-\r
-       if (ppLayers){\r
-               for (long m=0; m<GetNumLayers(); m++){\r
-                       if (GetLayer(m)){\r
-                               n += 1 + GetLayer(m)->DumpSize();\r
-                       }\r
-               }\r
-       } else n++;\r
-\r
-       if (ppFrames){\r
-               for (long m=0; m<GetNumFrames(); m++){\r
-                       if (GetFrame(m)){\r
-                               n += 1 + GetFrame(m)->DumpSize();\r
-                       }\r
-               }\r
-       } else n++;\r
-\r
-       return n;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::Dump(BYTE * dst)\r
-{\r
-       if (!dst) return 0;\r
-\r
-       memcpy(dst,&head,sizeof(BITMAPINFOHEADER));\r
-       dst += sizeof(BITMAPINFOHEADER);\r
-\r
-       memcpy(dst,&info,sizeof(CXIMAGEINFO));\r
-       dst += sizeof(CXIMAGEINFO);\r
-\r
-       memcpy(dst,pDib,GetSize());\r
-       dst += GetSize();\r
-\r
-       if (pAlpha){\r
-               memset(dst++, 1, 1);\r
-               memcpy(dst,pAlpha,head.biWidth * head.biHeight);\r
-               dst += head.biWidth * head.biHeight;\r
-       } else {\r
-               memset(dst++, 0, 1);\r
-       }\r
-\r
-       if (pSelection){\r
-               memset(dst++, 1, 1);\r
-               memcpy(dst,pSelection,head.biWidth * head.biHeight);\r
-               dst += head.biWidth * head.biHeight;\r
-       } else {\r
-               memset(dst++, 0, 1);\r
-       }\r
-\r
-       if (ppLayers){\r
-               memset(dst++, 1, 1);\r
-               for (long m=0; m<GetNumLayers(); m++){\r
-                       if (GetLayer(m)){\r
-                               dst += GetLayer(m)->Dump(dst);\r
-                       }\r
-               }\r
-       } else {\r
-               memset(dst++, 0, 1);\r
-       }\r
-\r
-       if (ppFrames){\r
-               memset(dst++, 1, 1);\r
-               for (long m=0; m<GetNumFrames(); m++){\r
-                       if (GetFrame(m)){\r
-                               dst += GetFrame(m)->Dump(dst);\r
-                       }\r
-               }\r
-       } else {\r
-               memset(dst++, 0, 1);\r
-       }\r
-\r
-       return DumpSize();\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-DWORD CxImage::UnDump(const BYTE * src)\r
-{\r
-       if (!src)\r
-               return 0;\r
-       if (!Destroy())\r
-               return 0;\r
-       if (!DestroyFrames())\r
-               return 0;\r
-\r
-       DWORD n = 0;\r
-\r
-       memcpy(&head,src,sizeof(BITMAPINFOHEADER));\r
-       n += sizeof(BITMAPINFOHEADER);\r
-\r
-       memcpy(&info,&src[n],sizeof(CXIMAGEINFO));\r
-       n += sizeof(CXIMAGEINFO);\r
-\r
-       if (!Create(head.biWidth, head.biHeight, head.biBitCount, info.dwType))\r
-               return 0;\r
-\r
-       memcpy(pDib,&src[n],GetSize());\r
-       n += GetSize();\r
-\r
-       if (src[n++]){\r
-               if (AlphaCreate()){\r
-                       memcpy(pAlpha, &src[n], head.biWidth * head.biHeight);\r
-               }\r
-               n += head.biWidth * head.biHeight;\r
-       }\r
-\r
-       if (src[n++]){\r
-               RECT box = info.rSelectionBox;\r
-               if (SelectionCreate()){\r
-                       info.rSelectionBox = box;\r
-                       memcpy(pSelection, &src[n], head.biWidth * head.biHeight);\r
-               }\r
-               n += head.biWidth * head.biHeight;\r
-       }\r
-\r
-       if (src[n++]){\r
-               ppLayers = new CxImage*[info.nNumLayers];\r
-               for (long m=0; m<GetNumLayers(); m++){\r
-                       ppLayers[m] = new CxImage();\r
-                       n += ppLayers[m]->UnDump(&src[n]);\r
-               }\r
-       }\r
-\r
-       if (src[n++]){\r
-               ppFrames = new CxImage*[info.nNumFrames];\r
-               for (long m=0; m<GetNumFrames(); m++){\r
-                       ppFrames[m] = new CxImage();\r
-                       n += ppFrames[m]->UnDump(&src[n]);\r
-               }\r
-       }\r
-\r
-       return n;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-/**\r
- * \return A.BBCCCDDDD\r
- *  - A = main version\r
- *  - BB = main revision\r
- *  - CCC = minor revision (letter)\r
- *  - DDDD = experimental revision\r
- */\r
-const float CxImage::GetVersionNumber()\r
-{\r
-       return 6.000000015f;\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
-const TCHAR* CxImage::GetVersion()\r
-{\r
-       static const TCHAR CxImageVersion[] = _T("CxImage 6.0.0");\r
-       return (CxImageVersion);\r
-}\r
-////////////////////////////////////////////////////////////////////////////////\r
+// ximainfo.cpp : main attributes
+/* 03/10/2004 v1.00 - Davide Pizzolato - www.xdp.it
+ * CxImage version 6.0.0 02/Feb/2008
+ */
+
+#include "ximage.h"
+
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return the color used for transparency, and/or for background color
+ */
+RGBQUAD        CxImage::GetTransColor()
+{
+       if (head.biBitCount<24 && info.nBkgndIndex>=0) return GetPaletteColor((BYTE)info.nBkgndIndex);
+       return info.nBkgndColor;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Gets the index used for transparency. Returns -1 for no transparancy.
+ */
+long CxImage::GetTransIndex() const
+{
+       return info.nBkgndIndex;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Sets the index used for transparency with 1, 4 and 8 bpp images. Set to -1 to remove the effect.
+ */
+void CxImage::SetTransIndex(long idx)
+{
+       if (idx<(long)head.biClrUsed)
+               info.nBkgndIndex = idx;
+       else 
+               info.nBkgndIndex = 0;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Sets the color used for transparency with 24 bpp images.
+ * You must call SetTransIndex(0) to enable the effect, SetTransIndex(-1) to disable it.
+ */
+void CxImage::SetTransColor(RGBQUAD rgb)
+{
+       rgb.rgbReserved=0;
+       info.nBkgndColor = rgb;
+}
+////////////////////////////////////////////////////////////////////////////////
+bool CxImage::IsTransparent() const
+{
+       return info.nBkgndIndex>=0; // <vho>
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Returns true if the image has 256 colors or less.
+ */
+bool CxImage::IsIndexed() const
+{
+       return head.biClrUsed!=0;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return 1 = indexed, 2 = RGB, 4 = RGBA
+ */
+BYTE CxImage::GetColorType()
+{
+       BYTE b = (BYTE)((head.biBitCount>8) ? 2 /*COLORTYPE_COLOR*/ : 1 /*COLORTYPE_PALETTE*/);
+#if CXIMAGE_SUPPORT_ALPHA
+       if (AlphaIsValid()) b = 4 /*COLORTYPE_ALPHA*/;
+#endif //CXIMAGE_SUPPORT_ALPHA
+       return b;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return Resolution for TIFF, JPEG, PNG and BMP formats.
+ */
+long CxImage::GetXDPI() const
+{
+       return info.xDPI;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return Resolution for TIFF, JPEG, PNG and BMP formats.
+ */
+long CxImage::GetYDPI() const
+{
+       return info.yDPI;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Set resolution for TIFF, JPEG, PNG and BMP formats.
+ */
+void CxImage::SetXDPI(long dpi)
+{
+       if (dpi<=0) dpi = CXIMAGE_DEFAULT_DPI;
+       info.xDPI = dpi;
+       head.biXPelsPerMeter = (long) floor(dpi * 10000.0 / 254.0 + 0.5);
+       if (pDib) ((BITMAPINFOHEADER*)pDib)->biXPelsPerMeter = head.biXPelsPerMeter;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Set resolution for TIFF, JPEG, PNG and BMP formats.
+ */
+void CxImage::SetYDPI(long dpi)
+{
+       if (dpi<=0) dpi = CXIMAGE_DEFAULT_DPI;
+       info.yDPI = dpi;
+       head.biYPelsPerMeter = (long) floor(dpi * 10000.0 / 254.0 + 0.5);
+       if (pDib) ((BITMAPINFOHEADER*)pDib)->biYPelsPerMeter = head.biYPelsPerMeter;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \sa SetFlags
+ */
+DWORD CxImage::GetFlags() const
+{
+       return info.dwFlags;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Image flags, for future use
+ * \param flags
+ *  - 0x??00000 = reserved for 16 bit, CMYK, multilayer
+ *  - 0x00??0000 = blend modes
+ *  - 0x0000???? = layer id or user flags
+ *
+ * \param bLockReservedFlags protects the "reserved" and "blend modes" flags 
+ */
+void CxImage::SetFlags(DWORD flags, bool bLockReservedFlags)
+{
+       if (bLockReservedFlags) info.dwFlags = flags & 0x0000ffff;
+       else info.dwFlags = flags;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \sa SetCodecOption
+ */
+DWORD CxImage::GetCodecOption(DWORD imagetype)
+{
+       imagetype = GetTypeIndexFromId(imagetype);
+       if (imagetype==0){
+               imagetype = GetTypeIndexFromId(GetType());
+       }
+       return info.dwCodecOpt[imagetype];
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Encode option for GIF, TIF and JPG.
+ * - GIF : 0 = LZW (default), 1 = none, 2 = RLE.
+ * - TIF : 0 = automatic (default), or a valid compression code as defined in "tiff.h" (COMPRESSION_NONE = 1, COMPRESSION_CCITTRLE = 2, ...)
+ * - JPG : valid values stored in enum CODEC_OPTION ( ENCODE_BASELINE = 0x01, ENCODE_PROGRESSIVE = 0x10, ...)
+ * - RAW : valid values stored in enum CODEC_OPTION ( DECODE_QUALITY_LIN = 0x00, DECODE_QUALITY_VNG = 0x01, ...)
+ *
+ * \return true if everything is ok
+ */
+bool CxImage::SetCodecOption(DWORD opt, DWORD imagetype)
+{
+       imagetype = GetTypeIndexFromId(imagetype);
+       if (imagetype==0){
+               imagetype = GetTypeIndexFromId(GetType());
+       }
+       info.dwCodecOpt[imagetype] = opt;
+       return true;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return internal hDib object..
+ */
+void* CxImage::GetDIB() const
+{
+       return pDib;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetHeight() const
+{
+       return head.biHeight;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetWidth() const
+{
+       return head.biWidth;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return DWORD aligned width of the image.
+ */
+DWORD CxImage::GetEffWidth() const
+{
+       return info.dwEffWidth;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return 2, 16, 256; 0 for RGB images.
+ */
+DWORD CxImage::GetNumColors() const
+{
+       return head.biClrUsed;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return: 1, 4, 8, 24.
+ */
+WORD CxImage::GetBpp() const
+{
+       return head.biBitCount;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return original image format
+ * \sa ENUM_CXIMAGE_FORMATS.
+ */
+DWORD CxImage::GetType() const
+{
+       return info.dwType;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * change image format identifier
+ * \sa ENUM_CXIMAGE_FORMATS.
+ */
+bool CxImage::SetType(DWORD type)
+{
+       switch (type){
+#if CXIMAGE_SUPPORT_BMP
+       case CXIMAGE_FORMAT_BMP:
+#endif
+#if CXIMAGE_SUPPORT_GIF
+       case CXIMAGE_FORMAT_GIF:
+#endif
+#if CXIMAGE_SUPPORT_JPG
+       case CXIMAGE_FORMAT_JPG:
+#endif
+#if CXIMAGE_SUPPORT_PNG
+       case CXIMAGE_FORMAT_PNG:
+#endif
+#if CXIMAGE_SUPPORT_MNG
+       case CXIMAGE_FORMAT_MNG:
+#endif
+#if CXIMAGE_SUPPORT_ICO
+       case CXIMAGE_FORMAT_ICO:
+#endif
+#if CXIMAGE_SUPPORT_TIF
+       case CXIMAGE_FORMAT_TIF:
+#endif
+#if CXIMAGE_SUPPORT_TGA
+       case CXIMAGE_FORMAT_TGA:
+#endif
+#if CXIMAGE_SUPPORT_PCX
+       case CXIMAGE_FORMAT_PCX:
+#endif
+#if CXIMAGE_SUPPORT_WBMP
+       case CXIMAGE_FORMAT_WBMP:
+#endif
+#if CXIMAGE_SUPPORT_WMF
+       case CXIMAGE_FORMAT_WMF:
+#endif
+#if CXIMAGE_SUPPORT_JBG
+       case CXIMAGE_FORMAT_JBG:
+#endif
+#if CXIMAGE_SUPPORT_JP2
+       case CXIMAGE_FORMAT_JP2:
+#endif
+#if CXIMAGE_SUPPORT_JPC
+       case CXIMAGE_FORMAT_JPC:
+#endif
+#if CXIMAGE_SUPPORT_PGX
+       case CXIMAGE_FORMAT_PGX:
+#endif
+#if CXIMAGE_SUPPORT_PNM
+       case CXIMAGE_FORMAT_PNM:
+#endif
+#if CXIMAGE_SUPPORT_RAS
+       case CXIMAGE_FORMAT_RAS:
+#endif
+#if CXIMAGE_SUPPORT_SKA
+       case CXIMAGE_FORMAT_SKA:
+#endif
+#if CXIMAGE_SUPPORT_RAW
+       case CXIMAGE_FORMAT_RAW:
+#endif
+               info.dwType = type;
+               return true;
+       }
+       info.dwType = CXIMAGE_FORMAT_UNKNOWN;
+       return false;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetNumTypes()
+{
+       return CMAX_IMAGE_FORMATS-1;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetTypeIdFromName(const TCHAR* ext)
+{
+#if CXIMAGE_SUPPORT_BMP
+       if (_tcsnicmp(ext,_T("bmp"),3)==0 )             return CXIMAGE_FORMAT_BMP;
+#endif
+#if CXIMAGE_SUPPORT_JPG
+       if (_tcsnicmp(ext,_T("jpg"),3)==0 ||
+               _tcsnicmp(ext,_T("jpe"),3)==0 ||
+               _tcsnicmp(ext,_T("jfi"),3)==0 )         return CXIMAGE_FORMAT_JPG;
+#endif
+#if CXIMAGE_SUPPORT_GIF
+       if (_tcsnicmp(ext,_T("gif"),3)==0 )             return CXIMAGE_FORMAT_GIF;
+#endif
+#if CXIMAGE_SUPPORT_PNG
+       if (_tcsnicmp(ext,_T("png"),3)==0 )             return CXIMAGE_FORMAT_PNG;
+#endif
+#if CXIMAGE_SUPPORT_ICO
+       if (_tcsnicmp(ext,_T("ico"),3)==0 ||
+               _tcsnicmp(ext,_T("cur"),3)==0 )         return CXIMAGE_FORMAT_ICO;
+#endif
+#if CXIMAGE_SUPPORT_TIF
+       if (_tcsnicmp(ext,_T("tif"),3)==0 )             return CXIMAGE_FORMAT_TIF;
+#endif
+#if CXIMAGE_SUPPORT_TGA
+       if (_tcsnicmp(ext,_T("tga"),3)==0 )             return CXIMAGE_FORMAT_TGA;
+#endif
+#if CXIMAGE_SUPPORT_PCX
+       if (_tcsnicmp(ext,_T("pcx"),3)==0 )             return CXIMAGE_FORMAT_PCX;
+#endif
+#if CXIMAGE_SUPPORT_WBMP
+       if (_tcsnicmp(ext,_T("wbm"),3)==0 )             return CXIMAGE_FORMAT_WBMP;
+#endif
+#if CXIMAGE_SUPPORT_WMF
+       if (_tcsnicmp(ext,_T("wmf"),3)==0 ||
+               _tcsnicmp(ext,_T("emf"),3)==0 )         return CXIMAGE_FORMAT_WMF;
+#endif
+#if CXIMAGE_SUPPORT_JP2
+       if (_tcsnicmp(ext,_T("jp2"),3)==0 ||
+               _tcsnicmp(ext,_T("j2k"),3)==0 )         return CXIMAGE_FORMAT_JP2;
+#endif
+#if CXIMAGE_SUPPORT_JPC
+       if (_tcsnicmp(ext,_T("jpc"),3)==0 ||
+               _tcsnicmp(ext,_T("j2c"),3)==0 )         return CXIMAGE_FORMAT_JPC;
+#endif
+#if CXIMAGE_SUPPORT_PGX
+       if (_tcsnicmp(ext,_T("pgx"),3)==0 )             return CXIMAGE_FORMAT_PGX;
+#endif
+#if CXIMAGE_SUPPORT_RAS
+       if (_tcsnicmp(ext,_T("ras"),3)==0 )             return CXIMAGE_FORMAT_RAS;
+#endif
+#if CXIMAGE_SUPPORT_PNM
+       if (_tcsnicmp(ext,_T("pnm"),3)==0 ||
+               _tcsnicmp(ext,_T("pgm"),3)==0 ||
+               _tcsnicmp(ext,_T("ppm"),3)==0 )         return CXIMAGE_FORMAT_PNM;
+#endif
+#if CXIMAGE_SUPPORT_JBG
+       if (_tcsnicmp(ext,_T("jbg"),3)==0 )             return CXIMAGE_FORMAT_JBG;
+#endif
+#if CXIMAGE_SUPPORT_MNG
+       if (_tcsnicmp(ext,_T("mng"),3)==0 ||
+               _tcsnicmp(ext,_T("jng"),3)==0 )         return CXIMAGE_FORMAT_MNG;
+#endif
+#if CXIMAGE_SUPPORT_SKA
+       if (_tcsnicmp(ext,_T("ska"),3)==0 )             return CXIMAGE_FORMAT_SKA;
+#endif
+#if CXIMAGE_SUPPORT_RAW
+       if (_tcsnicmp(ext,_T("nef"),3)==0 ||
+               _tcsnicmp(ext,_T("crw"),3)==0 ||
+               _tcsnicmp(ext,_T("cr2"),3)==0 ||
+               _tcsnicmp(ext,_T("dng"),3)==0 ||
+               _tcsnicmp(ext,_T("arw"),3)==0 ||
+               _tcsnicmp(ext,_T("erf"),3)==0 ||
+               _tcsnicmp(ext,_T("3fr"),3)==0 ||
+               _tcsnicmp(ext,_T("dcr"),3)==0 ||
+               _tcsnicmp(ext,_T("raw"),3)==0 ||
+               _tcsnicmp(ext,_T("x3f"),3)==0 ||
+               _tcsnicmp(ext,_T("mef"),3)==0 ||
+               _tcsnicmp(ext,_T("raf"),3)==0 ||
+               _tcsnicmp(ext,_T("mrw"),3)==0 ||
+               _tcsnicmp(ext,_T("pef"),3)==0 ||
+               _tcsnicmp(ext,_T("sr2"),3)==0 ||
+               _tcsnicmp(ext,_T("orf"),3)==0 )         return CXIMAGE_FORMAT_RAW;
+#endif
+
+       return CXIMAGE_FORMAT_UNKNOWN;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetTypeIdFromIndex(const DWORD index)
+{
+       DWORD n;
+
+       n=0; if (index == n) return CXIMAGE_FORMAT_UNKNOWN;
+#if CXIMAGE_SUPPORT_BMP
+       n++; if (index == n) return CXIMAGE_FORMAT_BMP;
+#endif
+#if CXIMAGE_SUPPORT_GIF
+       n++; if (index == n) return CXIMAGE_FORMAT_GIF;
+#endif
+#if CXIMAGE_SUPPORT_JPG
+       n++; if (index == n) return CXIMAGE_FORMAT_JPG;
+#endif
+#if CXIMAGE_SUPPORT_PNG
+       n++; if (index == n) return CXIMAGE_FORMAT_PNG;
+#endif
+#if CXIMAGE_SUPPORT_ICO
+       n++; if (index == n) return CXIMAGE_FORMAT_ICO;
+#endif
+#if CXIMAGE_SUPPORT_TIF
+       n++; if (index == n) return CXIMAGE_FORMAT_TIF;
+#endif
+#if CXIMAGE_SUPPORT_TGA
+       n++; if (index == n) return CXIMAGE_FORMAT_TGA;
+#endif
+#if CXIMAGE_SUPPORT_PCX
+       n++; if (index == n) return CXIMAGE_FORMAT_PCX;
+#endif
+#if CXIMAGE_SUPPORT_WBMP
+       n++; if (index == n) return CXIMAGE_FORMAT_WBMP;
+#endif
+#if CXIMAGE_SUPPORT_WMF
+       n++; if (index == n) return CXIMAGE_FORMAT_WMF;
+#endif
+#if CXIMAGE_SUPPORT_JP2
+       n++; if (index == n) return CXIMAGE_FORMAT_JP2;
+#endif
+#if CXIMAGE_SUPPORT_JPC
+       n++; if (index == n) return CXIMAGE_FORMAT_JPC;
+#endif
+#if CXIMAGE_SUPPORT_PGX
+       n++; if (index == n) return CXIMAGE_FORMAT_PGX;
+#endif
+#if CXIMAGE_SUPPORT_PNM
+       n++; if (index == n) return CXIMAGE_FORMAT_PNM;
+#endif
+#if CXIMAGE_SUPPORT_RAS
+       n++; if (index == n) return CXIMAGE_FORMAT_RAS;
+#endif
+#if CXIMAGE_SUPPORT_JBG
+       n++; if (index == n) return CXIMAGE_FORMAT_JBG;
+#endif
+#if CXIMAGE_SUPPORT_MNG
+       n++; if (index == n) return CXIMAGE_FORMAT_MNG;
+#endif
+#if CXIMAGE_SUPPORT_SKA
+       n++; if (index == n) return CXIMAGE_FORMAT_SKA;
+#endif
+#if CXIMAGE_SUPPORT_RAW
+       n++; if (index == n) return CXIMAGE_FORMAT_RAW;
+#endif
+
+       return CXIMAGE_FORMAT_UNKNOWN;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::GetTypeIndexFromId(const DWORD id)
+{
+       DWORD n;
+
+       n=0; if (id == CXIMAGE_FORMAT_UNKNOWN) return n;
+#if CXIMAGE_SUPPORT_BMP
+       n++; if (id == CXIMAGE_FORMAT_BMP) return n;
+#endif
+#if CXIMAGE_SUPPORT_GIF
+       n++; if (id == CXIMAGE_FORMAT_GIF) return n;
+#endif
+#if CXIMAGE_SUPPORT_JPG
+       n++; if (id == CXIMAGE_FORMAT_JPG) return n;
+#endif
+#if CXIMAGE_SUPPORT_PNG
+       n++; if (id == CXIMAGE_FORMAT_PNG) return n;
+#endif
+#if CXIMAGE_SUPPORT_ICO
+       n++; if (id == CXIMAGE_FORMAT_ICO) return n;
+#endif
+#if CXIMAGE_SUPPORT_TIF
+       n++; if (id == CXIMAGE_FORMAT_TIF) return n;
+#endif
+#if CXIMAGE_SUPPORT_TGA
+       n++; if (id == CXIMAGE_FORMAT_TGA) return n;
+#endif
+#if CXIMAGE_SUPPORT_PCX
+       n++; if (id == CXIMAGE_FORMAT_PCX) return n;
+#endif
+#if CXIMAGE_SUPPORT_WBMP
+       n++; if (id == CXIMAGE_FORMAT_WBMP) return n;
+#endif
+#if CXIMAGE_SUPPORT_WMF
+       n++; if (id == CXIMAGE_FORMAT_WMF) return n;
+#endif
+#if CXIMAGE_SUPPORT_JP2
+       n++; if (id == CXIMAGE_FORMAT_JP2) return n;
+#endif
+#if CXIMAGE_SUPPORT_JPC
+       n++; if (id == CXIMAGE_FORMAT_JPC) return n;
+#endif
+#if CXIMAGE_SUPPORT_PGX
+       n++; if (id == CXIMAGE_FORMAT_PGX) return n;
+#endif
+#if CXIMAGE_SUPPORT_PNM
+       n++; if (id == CXIMAGE_FORMAT_PNM) return n;
+#endif
+#if CXIMAGE_SUPPORT_RAS
+       n++; if (id == CXIMAGE_FORMAT_RAS) return n;
+#endif
+#if CXIMAGE_SUPPORT_JBG
+       n++; if (id == CXIMAGE_FORMAT_JBG) return n;
+#endif
+#if CXIMAGE_SUPPORT_MNG
+       n++; if (id == CXIMAGE_FORMAT_MNG) return n;
+#endif
+#if CXIMAGE_SUPPORT_SKA
+       n++; if (id == CXIMAGE_FORMAT_SKA) return n;
+#endif
+#if CXIMAGE_SUPPORT_RAW
+       n++; if (id == CXIMAGE_FORMAT_RAW) return n;
+#endif
+
+       return 0;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return current frame delay in milliseconds. Only for GIF and MNG formats.
+ */
+DWORD CxImage::GetFrameDelay() const
+{
+       return info.dwFrameDelay;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Sets current frame delay. Only for GIF format.
+ * \param d = delay in milliseconds
+ */
+void CxImage::SetFrameDelay(DWORD d)
+{
+       info.dwFrameDelay=d;
+}
+////////////////////////////////////////////////////////////////////////////////
+void CxImage::GetOffset(long *x,long *y)
+{
+       *x=info.xOffset;
+       *y=info.yOffset;
+}
+////////////////////////////////////////////////////////////////////////////////
+void CxImage::SetOffset(long x,long y)
+{
+       info.xOffset=x;
+       info.yOffset=y;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \sa SetJpegQuality, GetJpegQualityF
+ * \author [DP]; changes [Stefan Schürmans]
+ */
+BYTE CxImage::GetJpegQuality() const
+{
+       return (BYTE)(info.fQuality + 0.5f);
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \sa SetJpegQuality, GetJpegQuality
+ * \author [Stefan Schürmans]
+ */
+float CxImage::GetJpegQualityF() const
+{
+       return info.fQuality;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * quality level for JPEG and JPEG2000
+ * \param q: can be from 0 to 100
+ * \author [DP]; changes [Stefan Schürmans]
+ */
+void CxImage::SetJpegQuality(BYTE q){
+       info.fQuality = (float)q;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * quality level for JPEG and JPEG2000
+ * necessary for JPEG2000 when quality is between 0.0 and 1.0
+ * \param q: can be from 0.0 to 100.0
+ * \author [Stefan Schürmans]
+ */
+void CxImage::SetJpegQualityF(float q){
+       if (q>0) info.fQuality = q;
+       else  info.fQuality = 0.0f;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \sa SetJpegScale
+ */
+BYTE CxImage::GetJpegScale() const
+{
+       return info.nJpegScale;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * scaling down during JPEG decoding valid numbers are 1, 2, 4, 8
+ * \author [ignacio]
+ */
+void CxImage::SetJpegScale(BYTE q){
+       info.nJpegScale = q;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Used to monitor the slow loops.
+ * \return value is from 0 to 100.
+ * \sa SetProgress
+ */
+long CxImage::GetProgress() const
+{
+       return info.nProgress;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return the escape code.
+ * \sa SetEscape
+ */
+long CxImage::GetEscape() const
+{
+       return info.nEscape;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Forces the value of the internal progress variable.
+ * \param p should be from 0 to 100.
+ * \sa GetProgress
+ */
+void CxImage::SetProgress(long p)
+{
+       info.nProgress = p;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Used to quit the slow loops or the codecs.
+ * - SetEscape(-1) before Decode forces the function to exit, right after  
+ *   the image width and height are available ( for bmp, jpg, gif, tif )
+ */
+void CxImage::SetEscape(long i)
+{
+       info.nEscape = i;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Checks if the image is correctly initializated.
+ */
+bool CxImage::IsValid() const
+{
+       return pDib!=0;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * True if the image is enabled for painting.
+ */
+bool CxImage::IsEnabled() const
+{
+       return info.bEnabled;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Enables/disables the image.
+ */
+void CxImage::Enable(bool enable)
+{
+       info.bEnabled=enable;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * This function must be used after a Decode() / Load() call.
+ * Use the sequence SetFrame(-1); Load(...); GetNumFrames();
+ * to get the number of images without loading the first image.
+ * \return the number of images in the file.
+ */
+long CxImage::GetNumFrames() const
+{
+       return info.nNumFrames;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return the current selected image (zero-based index).
+ */
+long CxImage::GetFrame() const
+{
+       return info.nFrame;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Sets the image number that the next Decode() / Load() call will load
+ */
+void CxImage::SetFrame(long nFrame){
+       info.nFrame=nFrame;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Sets the method for drawing the frame related to others
+ * \sa GetDisposalMethod
+ */
+void CxImage::SetDisposalMethod(BYTE dm)
+{      info.dispmeth=dm; }
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Gets the method for drawing the frame related to others
+ * Values :    0 -   No disposal specified. The decoder is
+ *                   not required to take any action.
+ *             1 -   Do not dispose. The graphic is to be left
+ *                   in place.
+ *             2 -   Restore to background color. The area used by the
+ *                   graphic must be restored to the background color.
+ *             3 -   Restore to previous. The decoder is required to
+ *                   restore the area overwritten by the graphic with
+ *                   what was there prior to rendering the graphic.
+ *             4-7 -    To be defined.
+ */
+BYTE CxImage::GetDisposalMethod() const
+{      return info.dispmeth; }
+////////////////////////////////////////////////////////////////////////////////
+bool CxImage::GetRetreiveAllFrames() const
+{      return info.bGetAllFrames; }
+////////////////////////////////////////////////////////////////////////////////
+void CxImage::SetRetreiveAllFrames(bool flag)
+{      info.bGetAllFrames = flag; }
+////////////////////////////////////////////////////////////////////////////////
+CxImage * CxImage::GetFrame(long nFrame) const
+{
+       if ( ppFrames == NULL) return NULL;
+       if ( info.nNumFrames == 0) return NULL;
+       if ( nFrame >= info.nNumFrames ) return NULL;
+       if ( nFrame < 0) nFrame = info.nNumFrames - 1;
+       return ppFrames[nFrame];
+}
+////////////////////////////////////////////////////////////////////////////////
+short CxImage::ntohs(const short word)
+{
+       if (info.bLittleEndianHost) return word;
+       return ( (word & 0xff) << 8 ) | ( (word >> 8) & 0xff );
+}
+////////////////////////////////////////////////////////////////////////////////
+long CxImage::ntohl(const long dword)
+{
+       if (info.bLittleEndianHost) return dword;
+       return  ((dword & 0xff) << 24 ) | ((dword & 0xff00) << 8 ) |
+                       ((dword >> 8) & 0xff00) | ((dword >> 24) & 0xff);
+}
+////////////////////////////////////////////////////////////////////////////////
+void CxImage::bihtoh(BITMAPINFOHEADER* bih)
+{
+       bih->biSize = ntohl(bih->biSize);
+       bih->biWidth = ntohl(bih->biWidth);
+       bih->biHeight = ntohl(bih->biHeight);
+       bih->biPlanes = ntohs(bih->biPlanes);
+       bih->biBitCount = ntohs(bih->biBitCount);
+       bih->biCompression = ntohl(bih->biCompression);
+       bih->biSizeImage = ntohl(bih->biSizeImage);
+       bih->biXPelsPerMeter = ntohl(bih->biXPelsPerMeter);
+       bih->biYPelsPerMeter = ntohl(bih->biYPelsPerMeter);
+       bih->biClrUsed = ntohl(bih->biClrUsed);
+       bih->biClrImportant = ntohl(bih->biClrImportant);
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Returns the last reported error.
+ */
+const char* CxImage::GetLastError()
+{
+       return info.szLastError;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::DumpSize()
+{
+       DWORD n;
+       n = sizeof(BITMAPINFOHEADER) + sizeof(CXIMAGEINFO) + GetSize();
+
+       if (pAlpha){
+               n += 1 + head.biWidth * head.biHeight;
+       } else n++;
+
+       if (pSelection){
+               n += 1 + head.biWidth * head.biHeight;
+       } else n++;
+
+       if (ppLayers){
+               for (long m=0; m<GetNumLayers(); m++){
+                       if (GetLayer(m)){
+                               n += 1 + GetLayer(m)->DumpSize();
+                       }
+               }
+       } else n++;
+
+       if (ppFrames){
+               for (long m=0; m<GetNumFrames(); m++){
+                       if (GetFrame(m)){
+                               n += 1 + GetFrame(m)->DumpSize();
+                       }
+               }
+       } else n++;
+
+       return n;
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::Dump(BYTE * dst)
+{
+       if (!dst) return 0;
+
+       memcpy(dst,&head,sizeof(BITMAPINFOHEADER));
+       dst += sizeof(BITMAPINFOHEADER);
+
+       memcpy(dst,&info,sizeof(CXIMAGEINFO));
+       dst += sizeof(CXIMAGEINFO);
+
+       memcpy(dst,pDib,GetSize());
+       dst += GetSize();
+
+       if (pAlpha){
+               memset(dst++, 1, 1);
+               memcpy(dst,pAlpha,head.biWidth * head.biHeight);
+               dst += head.biWidth * head.biHeight;
+       } else {
+               memset(dst++, 0, 1);
+       }
+
+       if (pSelection){
+               memset(dst++, 1, 1);
+               memcpy(dst,pSelection,head.biWidth * head.biHeight);
+               dst += head.biWidth * head.biHeight;
+       } else {
+               memset(dst++, 0, 1);
+       }
+
+       if (ppLayers){
+               memset(dst++, 1, 1);
+               for (long m=0; m<GetNumLayers(); m++){
+                       if (GetLayer(m)){
+                               dst += GetLayer(m)->Dump(dst);
+                       }
+               }
+       } else {
+               memset(dst++, 0, 1);
+       }
+
+       if (ppFrames){
+               memset(dst++, 1, 1);
+               for (long m=0; m<GetNumFrames(); m++){
+                       if (GetFrame(m)){
+                               dst += GetFrame(m)->Dump(dst);
+                       }
+               }
+       } else {
+               memset(dst++, 0, 1);
+       }
+
+       return DumpSize();
+}
+////////////////////////////////////////////////////////////////////////////////
+DWORD CxImage::UnDump(const BYTE * src)
+{
+       if (!src)
+               return 0;
+       if (!Destroy())
+               return 0;
+       if (!DestroyFrames())
+               return 0;
+
+       DWORD n = 0;
+
+       memcpy(&head,src,sizeof(BITMAPINFOHEADER));
+       n += sizeof(BITMAPINFOHEADER);
+
+       memcpy(&info,&src[n],sizeof(CXIMAGEINFO));
+       n += sizeof(CXIMAGEINFO);
+
+       if (!Create(head.biWidth, head.biHeight, head.biBitCount, info.dwType))
+               return 0;
+
+       memcpy(pDib,&src[n],GetSize());
+       n += GetSize();
+
+       if (src[n++]){
+               if (AlphaCreate()){
+                       memcpy(pAlpha, &src[n], head.biWidth * head.biHeight);
+               }
+               n += head.biWidth * head.biHeight;
+       }
+
+       if (src[n++]){
+               RECT box = info.rSelectionBox;
+               if (SelectionCreate()){
+                       info.rSelectionBox = box;
+                       memcpy(pSelection, &src[n], head.biWidth * head.biHeight);
+               }
+               n += head.biWidth * head.biHeight;
+       }
+
+       if (src[n++]){
+               ppLayers = new CxImage*[info.nNumLayers];
+               for (long m=0; m<GetNumLayers(); m++){
+                       ppLayers[m] = new CxImage();
+                       n += ppLayers[m]->UnDump(&src[n]);
+               }
+       }
+
+       if (src[n++]){
+               ppFrames = new CxImage*[info.nNumFrames];
+               for (long m=0; m<GetNumFrames(); m++){
+                       ppFrames[m] = new CxImage();
+                       n += ppFrames[m]->UnDump(&src[n]);
+               }
+       }
+
+       return n;
+}
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * \return A.BBCCCDDDD
+ *  - A = main version
+ *  - BB = main revision
+ *  - CCC = minor revision (letter)
+ *  - DDDD = experimental revision
+ */
+const float CxImage::GetVersionNumber()
+{
+       return 6.000000015f;
+}
+////////////////////////////////////////////////////////////////////////////////
+const TCHAR* CxImage::GetVersion()
+{
+       static const TCHAR CxImageVersion[] = _T("CxImage 6.0.0");
+       return (CxImageVersion);
+}
+////////////////////////////////////////////////////////////////////////////////