// Copyright (C) 1991 - 1999 Rational Software Corporation
#include "stdafx.h"
#include "CCanvas.h"
#include "CGDICanvasImpl.h"
#include "CDDCanvasImpl.h"
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Create
// �������� : ������������Ĭ��Ϊ����DirectDrawģʽ
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] CWnd* pWnd
//
// �� �� : [in] UINT uID Ĭ��ֵΪ CANVAS_DDRAW
//
HRESULT CCanvas::Create(CWnd* pWnd, UINT uID)
{
switch(uID)
{
case CANVAS_GDI: //GDIģʽ
m_pImpl = new CGDICanvasImpl(pWnd);
break;
case CANVAS_DDRAW: //DirectDrawģʽ
m_pImpl = new CDDCanvasImpl(pWnd);
break;
default:
m_pImpl = new CGDICanvasImpl(pWnd);
break;
}
return 0;
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::PutPixel
// �������� : ���������ɫ
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X
//
// �� �� : [in] int Y
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::PutPixel(int X, int Y, DWORD Col)
{
return m_pImpl->PutPixel(X, Y, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetPixel
// �������� : ȡ��ָ��λ��������ɫֵ
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : DWORD
//
// �� �� : [in] int X
//
// �� �� : [in] int Y
//
DWORD CCanvas::GetPixel(int X, int Y)
{
return m_pImpl->GetPixel(X, Y);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Rect
// �������� : ���ƾ���
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X1
//
// �� �� : [in] int Y1
//
// �� �� : [in] int X2
//
// �� �� : [in] int Y2
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::Rect(int X1, int Y1, int X2, int Y2, DWORD Col)
{
return m_pImpl->Rect(X1, Y1, X2, Y2, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::FillRect
// �������� :
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� : ����������
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X1
//
// �� �� : [in] int Y1
//
// �� �� : [in] int X2
//
// �� �� : [in] int Y2
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::FillRect(int X1, int Y1, int X2, int Y2, DWORD Col)
{
return m_pImpl->FillRect(X1, Y1, X2, Y2, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Line
// �������� :
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� : ��ָ����ɫ����ֱ��
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X1
//
// �� �� : [in] int Y1
//
// �� �� : [in] int X2
//
// �� �� : [in] int Y2
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::Line(int X1, int Y1, int X2, int Y2, DWORD Col)
{
return m_pImpl->Line(X1, Y1, X2, Y2, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Circle
// �������� : ��ָ����ɫ����Բ
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X
//
// �� �� : [in] int Y
//
// �� �� : [in] int Radius
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::Circle(int X, int Y, int Radius, DWORD Col)
{
return m_pImpl->Circle(X, Y, Radius, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::FillCircle
// �������� : ��ָ����ɫ���Բ
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X
//
// �� �� : [in] int Y
//
// �� �� : [in] int Radius
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::FillCircle(int X, int Y, int Radius, DWORD Col)
{
return m_pImpl->FillCircle(X, Y, Radius, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::RoundedRect
// �������� : ��ָ����ɫ����Բ�Ǿ���
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int X1
//
// �� �� : [in] int Y1
//
// �� �� : [in] int X2
//
// �� �� : [in] int Y2
//
// �� �� : [in] int Radius Բ�ǰ뾶
//
// �� �� : [in] DWORD Col
//
HRESULT CCanvas::RoundedRect(int X1, int Y1, int X2, int Y2, int Radius, DWORD Col)
{
return m_pImpl->RoundedRect(X1, Y1, X2, Y2, Radius, Col);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Fill
// �������� : ��ָ����ɫ���ҳ��
// �� �� : 2002-2-28
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] DWORD FillColor
//
HRESULT CCanvas::Fill(DWORD FillColor)
{
return m_pImpl->Fill(FillColor);
}
//##ModelId=3C1AF7BF03AA
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::TextOut
// �������� : ��ָ������λ�û����ַ���
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] int x
//
// �� �� : [in] int y
//
// �� �� : [in] COLORREF col
//
// �� �� : [in] LPCTSTR pString
//
HRESULT CCanvas::TextOut(int x, int y, COLORREF col, LPCTSTR pString)
{
return m_pImpl->TextOut(x, y, col, pString);
}
//##ModelId=3C1AF7BF03AF
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::DrawText
// �������� : ��ָ�������ڻ����ַ���
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] LPCSTR pString
//
// �� �� : [in] COLORREF col
//
// �� �� : [in] LPRECT pRect
//
HRESULT CCanvas::DrawText(LPCSTR pString, COLORREF col, LPRECT pRect)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->DrawText(pString, col, pRect);
}
//##ModelId=3C1AF7BF03B3
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::SaveAsBMP
// �������� : ���������λͼ�ļ�
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] const char* szFilename
//
HRESULT CCanvas::SaveAsBMP(const char* szFilename)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->SaveAsBMP(szFilename);
}
//##ModelId=3C1AF7BF03B5
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Blt
// �������� : ��λͼ���ݴ����豸�����ľ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : BOOL
//
// �� �� : [in] LPRECT pDestRect
//
// �� �� : [in] LPRECT pSrcRect
//
// �� �� : [in] CONST VOID *lpBits
//
// �� �� : [in] CONST BITMAPINFO *lpBitsInfo
//
BOOL CCanvas::Blt(LPRECT pDestRect, LPRECT pSrcRect, CONST VOID *lpBits, CONST BITMAPINFO *lpBitsInfo)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->Blt(pDestRect, pSrcRect, lpBits, lpBitsInfo);
}
//##ModelId=3C1AF7BF03BA
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::ClipRect
// �������� : �ü����
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : BOOL
//
// �� �� : [in] RECT *Rect //Ҫ�ü�ľ���
//
BOOL CCanvas::ClipRect(RECT *Rect)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->ClipRect(Rect);
}
//##ModelId=3C1AF7BF03BC
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Restore
// �������� : ���沢�ָ���������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
HRESULT CCanvas::Restore()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->Restore();
}
//##ModelId=3C1AF7BF03C2
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::SetFont
// �������� : ��������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] LPCTSTR FontName
//
// �� �� : [in] int Width
//
// �� �� : [in] int Height
//
// �� �� : [in] int Attributes
//
HRESULT CCanvas::SetFont(LPCTSTR FontName, int Width, int Height, int Attributes)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return 0;//m_pImpl->SetFont(FontName, Width, Height, Attributes);
}
//##ModelId=3C1AF7BF03C3
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Lock
// �������� : ��������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
HRESULT CCanvas::Lock()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->Lock();
}
//##ModelId=3C1AF7BF03C4
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::UnLock
// �������� : ��������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
HRESULT CCanvas::UnLock()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->UnLock();
}
//##ModelId=3C1AF7BF03C5
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetDC
// �������� : ȡ���豸�����ľ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HDC
//
HDC CCanvas::GetDC()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->GetDC();
}
//##ModelId=3C1AF7BF03C6
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::ReleaseDC
// �������� : �ͷ��豸�����ľ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
HRESULT CCanvas::ReleaseDC()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->ReleaseDC();
}
//##ModelId=3C1AF7BF03C7
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetWidth
// �������� : ȡ�û������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : int
//
int CCanvas::GetWidth()
{
// TODO: Add your specialized code here.
return m_pImpl->GetWidth();
}
//##ModelId=3C1AF7BF03C8
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetHeight
// �������� : ȡ�û����߶�
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : int
//
int CCanvas::GetHeight()
{
// TODO: Add your specialized code here.
return m_pImpl->GetHeight();
}
//##ModelId=3C1AF7BF03C9
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetSurfacePointer
// �������� : ȡ��ָ��ҳ���ָ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : void*
//
void* CCanvas::GetSurfacePointer()
{
// TODO: Add your specialized code here.
return m_pImpl->GetSurfacePointer();
}
//##ModelId=3C1AF7BF03CA
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetClipRect
// �������� : ȡ�òü��������ָ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : LPRECT
//
LPRECT CCanvas::GetClipRect()
{
// TODO: Add your specialized code here.
return m_pImpl->GetClipRect();
}
//##ModelId=3C1AF7BF03CB
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::SetClipRect
// �������� : ���òü��������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : void
//
// �� �� : [in] LPRECT pClipRect
//
void CCanvas::SetClipRect(LPRECT pClipRect)
{
// TODO: Add your specialized code here.
m_pImpl->SetClipRect(pClipRect);
}
//##ModelId=3C1AF7BF03CD
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetFontName
// �������� : ȡ����������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : char*
//
// �� �� : [in] char* name
//
char* CCanvas::GetFontName(char* name)
{
// TODO: Add your specialized code here.
return m_pImpl->GetFontName(name);
}
//##ModelId=3C1AF7BF03CF
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetSurfaceDescriptor
// �������� : ȡ�û���ҳ�������ṹ
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : void
//
// �� �� : [in] LPDDSURFACEDESC2 lpddsd
//
void CCanvas::GetSurfaceDescriptor(LPDDSURFACEDESC2 lpddsd)
{
m_pImpl->GetSurfaceDescriptor(lpddsd);
}
//##ModelId=3C1AF7BF03D1
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::GetDDS
// �������� : ȡ�û���ҳ��ָ��
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : LPDIRECTDRAWSURFACE7
//
LPDIRECTDRAWSURFACE7 CCanvas::GetDDS()
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
return m_pImpl->GetDDS();
}
//##ModelId=3C1AF7BF03D2
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Refresh
// �������� : �ػ滭��ָ����������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : LRESULT
//
// �� �� : [in] LPRECT pRect
//
LRESULT CCanvas::Refresh(LPRECT pRect)
{
// TODO: Add your specialized code here.
// NOTE: Requires a correct return value to compile.
Restore();
return m_pImpl->Refresh(pRect);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::LoadBitmap
// �������� : ��ȡBMPλͼ�ļ�
// �� �� : 2002-3-18
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] const char *szFilename
//
HRESULT CCanvas::LoadBitmap(const char *szFilename)
{
return m_pImpl->LoadBitmap(szFilename);
}
CCanvas::~CCanvas()
{
HRESULT val;
// Refresh(NULL);
val = Release();
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Release
// �������� : �ͷ���ʱ����
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
HRESULT CCanvas::Release()
{
HRESULT val;
val = m_pImpl->Release();
if(m_pImpl != NULL)
{
delete m_pImpl;
m_pImpl = NULL;
}
return val;
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Blt
// �������� : ��һ����������λ���͵�����һ��������
// �� �� : 2001-3-4
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] CCanvas *pSrcCanvas //Դ����
//
// �� �� : [in] LPRECT pDestRect //Ŀ�ľ���
//
// �� �� : [in] LPRECT pSrcRect //Դ����
//
HRESULT CCanvas::Blt(CCanvas *pSrcCanvas, LPRECT pDestRect, LPRECT pSrcRect)
{
return m_pImpl->Blt(pSrcCanvas->m_pImpl,pDestRect,pSrcRect);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::CCanvas
// �������� : ���캯������BPP������
// �� �� : 2002-3-13
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ :
//
// �� �� : [in] CWnd *pWnd
//
// �� �� : [in] UINT uID
//
// �� �� : [in] int Width
//
// �� �� : [in] int Height
//
// �� �� : [in] int BPP
//
CCanvas::CCanvas(CWnd *pWnd, UINT uID, int Width, int Height, int BPP)
{
Create(pWnd,uID,Width,Height,BPP);
}
//////////////////////////////////////////////////////////////////
// �� �� �� : CCanvas::Create
// �������� : ������������BPP������
// �� �� : 2002-3-13
//----------------------------------------------------------------
// �� �� �� :
// �� �� ֵ : HRESULT
//
// �� �� : [in] CWnd *pWnd
//
// �� �� : [in] UINT uID //Ĭ�����Ϊ��GDI���ƻ���
//
// �� �� : [in] int Width
//
// �� �� : [in] int Height
//
// �� �� : [in] int BPP �����
//
HRESULT CCanvas::Create(CWnd *pWnd, UINT uID, int Width, int Height, int BPP)
{
switch(uID)
{
case CANVAS_GDI: //GDIģʽ
m_pImpl = new CGDICanvasImpl(pWnd,Width,Height,BPP);
break;
case CANVAS_DDRAW: //DirectDrawģʽ
m_pImpl = new CDDCanvasImpl(pWnd,Width,Height,BPP);
break;
default:
m_pImpl = new CGDICanvasImpl(pWnd);
break;
}
return 0;
}