You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB
C

1 month ago
#pragma once
#include "WException.h"
namespace wuya
{
/** @brief Image<67><EFBFBD><ECB3A3> */
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 ͼ<><CDBC><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD> */
enum IMAGE_FORMAT
{
IF_BMP, ///< BMP<4D><50>ʽ
IF_JPG ///< JPG<50><47>ʽ
};
/** @brief ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
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;
};
}