|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F>ļ<EFBFBD> MemDC.h
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2005-12-07
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "afxwin.h"
|
|
|
|
|
|
#include "DrawLocal/MemAlloc.h"
|
|
|
|
|
|
|
|
|
|
|
|
class AFX_EXT_CLASS CMemoryDC : public CDC
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
CMemoryDC(void);
|
|
|
|
|
|
virtual ~CMemoryDC(void);
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
virtual BOOL Create(CSize &pImageSize,int nBPP=0, CDC* pDC=NULL);
|
|
|
|
|
|
virtual CSize GetSize(void);
|
|
|
|
|
|
virtual void Empty(void);
|
|
|
|
|
|
|
|
|
|
|
|
void Erase(COLORREF pColor);
|
|
|
|
|
|
void FromDC(CDC* pDC); //<2F><>ָ<EFBFBD><D6B8>DC<44><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
void Draw(CDC* pDC, int x, int y); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
void Draw(CDC* pDC, int x, int y, int cx, int cy); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WriteBitmap(LPCTSTR lpFileName, int nBt=0, BOOL bCompr=FALSE);
|
|
|
|
|
|
BOOL Save(LPCTSTR lpFileName);
|
|
|
|
|
|
BOOL CopyToClipboard(HWND hWnd=NULL);
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL FileDialog(BOOL bOpenFileDialog , CString &name);
|
|
|
|
|
|
static CString GetFilterType(BOOL bOpenFileDialog);
|
|
|
|
|
|
|
|
|
|
|
|
HBITMAP Detach();
|
|
|
|
|
|
operator HBITMAP(void) const;
|
|
|
|
|
|
operator CMemoryDC*(); // Allow usage as a pointer
|
|
|
|
|
|
CMemoryDC* operator->() {return this;} // Allow usage as a pointer
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
CMemAlloc m_memAlloc;
|
|
|
|
|
|
CImage image;
|
|
|
|
|
|
CSize cImageSize;
|
|
|
|
|
|
HBITMAP m_hOldBitmap;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
AFX_INLINE CMemoryDC::operator HBITMAP(void) const
|
|
|
|
|
|
{
|
|
|
|
|
|
return (HBITMAP)image;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AFX_INLINE CMemoryDC::operator CMemoryDC*()
|
|
|
|
|
|
{
|
|
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AFX_INLINE CSize CMemoryDC::GetSize(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
return cImageSize;
|
|
|
|
|
|
}
|