#pragma once #include "WException.h" namespace wuya { /** @brief Image异常类 */ class AFX_EXT_CLASS WExceptionImage : public WException { public: WExceptionImage() throw() : WException(_T("ExceptionImage")) {} WExceptionImage(std::string msg) throw() : WException(msg) {} WExceptionImage(std::string msg,std::string location) throw() : WException(msg,location) {} }; /** @brief 图像格式定义 */ enum IMAGE_FORMAT { IF_BMP, ///< BMP格式 IF_JPG ///< JPG格式 }; /** @brief 图像基类 */ class AFX_EXT_CLASS CImage { public: CImage(void) {}; virtual ~CImage(void) {}; virtual void Load(CString strFileName) throw(WExceptionImage) = 0; virtual void Load(CFile* pFile) throw(WExceptionImage) = 0; virtual void Save(CString strFileName) throw(WExceptionImage) = 0; virtual void Save(CFile* pFile) throw(WExceptionImage) = 0; virtual void Draw(CDC* pdc, int x=0, int y=0, double scale = 1.0, DWORD dwROPCode = SRCCOPY) const throw(WExceptionImage) = 0; virtual void Draw(CDC* pdc, int x, int y, int width, int height, DWORD dwROPCode = SRCCOPY) const throw(WExceptionImage) = 0; virtual void Create(int width, int height, LPBYTE pData, int bitCount=24) throw(WExceptionImage) = 0; virtual UINT GetWidth() const throw() = 0; virtual UINT GetHeight() const throw() = 0; virtual UINT GetBPP() const throw() = 0; virtual COLORREF GetPixel(int x, int y) const throw() = 0; virtual LPBYTE GetDibBits() const throw() = 0; }; }