/*
* File: ximage.h
* Purpose: General Purpose Image Class
*/
/* === C R E D I T S & D I S C L A I M E R S ==============
* Permission is given by the author to freely redistribute and include
* this code in any program as long as this credit is given where due.
*
* CxImage (c) 07/Aug/2001 <ing.davide.pizzolato@libero.it>
* CxImage version 5.00 23/Aug/2002
* See the file history.htm for the complete bugfix and news report.
*
* Special thanks to Troels Knakkergaard for new features, enhancements and bugfixes
*
* original CImage and CImageIterator implementation are:
* Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
*
* COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
* OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
* THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
* OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
* CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
* THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
* SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
* PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER.
*
* Use at your own risk!
* ==========================================================
*/
#if !defined(__MYFXIMAGE_H)
#define __MYFXIMAGE_H
#if _MSC_VER > 1000
#pragma once
#endif
/////////////////////////////////////////////////////////////////////////////
// CxImage supported features
#define CXIMAGE_SUPPORT_ALPHA 1
#define CXIMAGE_SUPPORT_SELECTION 1
#define CXIMAGE_SUPPORT_TRANSFORMATION 1
#define CXIMAGE_SUPPORT_DSP 1
#define CXIMAGE_SUPPORT_DECODE 1
#define CXIMAGE_SUPPORT_ENCODE 1 //<vho><T.Peck>
#define CXIMAGE_SUPPORT_WINDOWS 1
#define CXIMAGE_SUPPORT_WINCE 0 //<T.Peck>
/////////////////////////////////////////////////////////////////////////////
// CxImage supported formats
#define CXIMAGE_SUPPORT_BMP 1
#define CXIMAGE_SUPPORT_GIF 1
#define CXIMAGE_SUPPORT_JPG 1
#define CXIMAGE_SUPPORT_PNG 1
#define CXIMAGE_SUPPORT_MNG 0
#define CXIMAGE_SUPPORT_ICO 1
#define CXIMAGE_SUPPORT_TIF 1
#define CXIMAGE_SUPPORT_TGA 1
#define CXIMAGE_SUPPORT_PCX 1
#define CXIMAGE_SUPPORT_WBMP 1
#define CXIMAGE_SUPPORT_WMF 1
#define CXIMAGE_SUPPORT_J2K 0 // Beta
#define CXIMAGE_SUPPORT_JBG 0 // Patented! see ../jbig/patents.htm
/////////////////////////////////////////////////////////////////////////////
#include "xfile.h"
#include "xiofile.h"
#include "xmemfile.h"
#include "ximadefs.h" //<vho> adjust some #define
/////////////////////////////////////////////////////////////////////////////
// CxImage formats enumerator
enum ENUM_CXIMAGE_FORMATS{
#if CXIMAGE_SUPPORT_BMP
CXIMAGE_FORMAT_BMP,
#endif
#if CXIMAGE_SUPPORT_GIF
CXIMAGE_FORMAT_GIF,
#endif
#if CXIMAGE_SUPPORT_JPG
CXIMAGE_FORMAT_JPG,
#endif
#if CXIMAGE_SUPPORT_PNG
CXIMAGE_FORMAT_PNG,
#endif
#if CXIMAGE_SUPPORT_MNG
CXIMAGE_FORMAT_MNG,
#endif
#if CXIMAGE_SUPPORT_ICO
CXIMAGE_FORMAT_ICO,
#endif
#if CXIMAGE_SUPPORT_TIF
CXIMAGE_FORMAT_TIF,
#endif
#if CXIMAGE_SUPPORT_TGA
CXIMAGE_FORMAT_TGA,
#endif
#if CXIMAGE_SUPPORT_PCX
CXIMAGE_FORMAT_PCX,
#endif
#if CXIMAGE_SUPPORT_WBMP
CXIMAGE_FORMAT_WBMP,
#endif
#if CXIMAGE_SUPPORT_WMF // <vho> - Windows Metafile
CXIMAGE_FORMAT_WMF,
#endif
#if CXIMAGE_SUPPORT_J2K
CXIMAGE_FORMAT_J2K,
#endif
#if CXIMAGE_SUPPORT_JBG
CXIMAGE_FORMAT_JBG,
#endif
CMAX_IMAGE_FORMATS
};
// needed for png, gif, tga
#define RGB2GRAY(r,g,b) ((b*11 + g*59 + r*30)/100) //color to grey mapping
struct rgb_color { BYTE r,g,b; };
/////////////////////////////////////////////////////////////////////////////
// CxImage class
/////////////////////////////////////////////////////////////////////////////
class DLL_EXP CxImage
{
//extensible information collector
typedef struct tagCxImageInfo {
DWORD dwEffWidth; //DWORD aligned scan line width
BYTE* pImage; //THE IMAGE BITS
void* pGhost; //if this is a ghost, pGhost point 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)
BYTE bAlphaPaletteEnabled; //true if alpha values in the palette are enabled.
BYTE bEnabled; //enables the painting functions
long xOffset;
long yOffset;
} CXIMAGEINFO;
public:
//added by zzq 2005-01-20
CxImage(const char * filename,bool bSetGrayData=true,int color=1,bool lbOrLt=true);
bool GetImageType(const char * filename, int &type);
BYTE*pGrayData;//gray data of current image, original point is on the left-bottom
void SetGrayData(int color=1,bool lbOrLt=true);
BYTE*GetGrayData(){return pGrayData;}
//constructors
CxImage(DWORD imagetype = 0);
CxImage(DWORD dwWidth, DWORD dwHeight, long wBpp, long 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();
CxImage& operator = (const CxImage&);
//initializzation
void Destroy();
void* Create(DWORD dwWidth, DWORD dwHeight, long wBpp, long imagetype = 0);
bool CreateFromHANDLE(HANDLE hMem); //Windows objects (clipboard)
void Clear(BYTE bval=0);
void Copy(const CxImage &src, bool copypixels = true, bool copyselection = true, bool copyalpha = true);
HANDLE CopyToHandle();
void Transfer(CxImage &from);
//Attributes
long GetSize();
BYTE* GetBits();
BYTE GetColorType();
HANDLE GetDIB() const {return (HANDLE)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);
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) {info.nBkgndColor = rgb;}
bool IsTransparent() const {return info.nBkgndIndex>=0;} // <vho>
//palette operations
bool IsGrayScale();
bool IsIndexed() {return head.biClrUsed!=0;}
DWORD GetPaletteSize();
RGBQUAD* GetPalette() const;
RGBQUAD GetPaletteColor(BYTE idx);
bool GetRGB(int i, BYTE* r, BYTE* g, BYTE* b)
没有合适的资源?快使用搜索试试~ 我知道了~
CxImage运行库文件
共14个文件
lib:7个
h:6个
dll:1个
4星 · 超过85%的资源 需积分: 9 19 下载量 185 浏览量
2011-08-14
10:24:54
上传
评论
收藏 1.05MB RAR 举报
温馨提示
编译好的可直接使用的强大的cximage图像处理运行库.CxImage是一个可以用于MFC 的C++类,可以打开,保存,显示,转换各种格式的图像文件,比如BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX, TGA, WMF, WBMP, JBG, J2K 等格式的文件。可以实现BMP<->JPG,PNG <>TIFF格式等等的转换
资源推荐
资源详情
资源评论
收起资源包目录
CxImage运行库文件.rar (14个子文件)
CxImage运行库文件
CxImage
inc
memdc.h 3KB
xmemfile.h 2KB
ximage.h 15KB
xfile.h 2KB
xiofile.h 3KB
ximadefs.h 3KB
cximage.dll 1.38MB
lib
zlib.lib 182KB
Jpeg.lib 594KB
cximage.lib 1.93MB
Tiff.lib 1.24MB
jbig.lib 87KB
png.lib 590KB
j2000.lib 218KB
共 14 条
- 1
资源评论
- luoguolong26602013-06-06可以运行 不过有动态的应用程序 放弃了
discusspro
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功