⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cdc.h

📁 基于Windml2.0的窗口系统原代码 , 以及和MFC CDC兼容的CDC
💻 H
字号:
#ifndef cdc__vxWorks_h
#define cdc__vxWorks_h

//---------------------------------------------------------------------------------------------------------------------
#include "cdc_platform.h"
#include "crgn.h"
#include "crect.h"
#include "cpoint.h"
#include "cstring.h"
#include "cpen.h"
#include "cbrush.h"
#include "cbitmap.h"
#include "cfont.h"
#include "ugl/ugl.h"

class CDC 
{
public:
    //##ModelId=40500037000B
	CDC();
	
	CDC::CDC(UGL_GC_ID gc);
	
    //##ModelId=405000370063
	~CDC();

//API for windml
public:

		
	//取得相关的设备环境
	UGL_GC_ID GetGcID();	
	
	bool SetViewPort(int left , int top , int right , int  bottom);
	
	bool GetViewPort(int *left , int *top , int *right , int  *bottom); 
	
	//绘图操作之前调用
	void BeginDraw();
	
	//绘图操作之后调用
	void EndDraw();

public:
    //##ModelId=405000370065
	bool CreateCompatibleDC(CDC* pDC);		

    //##ModelId=405000370067
	CSize GetTextExtent (LPCTSTR lpszString, int nCount);

    //##ModelId=40500037006A
	CSize GetTextExtent (CString& str, int nCount);

    //##ModelId=40500037006F
	CSize GetTextExtent (const CString& str );

    //##ModelId=405000370071
	CSize GetTextExtent (const char* pStr);


	CFont* SelectObject(CFont* pFont);

    //##ModelId=405000370077
	CPen* SelectObject( CPen* pPen );

    //##ModelId=405000370079
	CBrush* SelectObject( CBrush* pBrush );

    //##ModelId=40500037007B
	int SelectObject( CRgn* pRgn );
    
    //##ModelId=40500037007D
	CBitmap* SelectObject(CBitmap* pBitmap);

    //##ModelId=405000370082
//	CGdiObject* SelectStockObject( int nIndex );

    //##ModelId=405000370084
	int GetClipBox( RECT *lpRect ) const;
    
    //##ModelId=40500037008B
	int GetClipBox( CRect *lpRect) const;
	
    //##ModelId=40500037008E
	int SetROP2( int nDrawMode );
    
    //##ModelId=405000370090
	int GetROP2();
                   
    //##ModelId=405000370091
	bool BitBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
		int xSrc, int ySrc, unsigned int dwRop );
		
	bool StretchBlt( int x, int y, int nWidth, int nHeight, CDC* pSrcDC, 
	int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, unsigned int dwRop );
		
    //##ModelId=4050003700A0
	bool Polygon( POINT *lpPoints, int nCount );

	//##ModelId=4050003700A0
	bool Polygon( CPoint *lpPoints, int nCount );
    
    //##ModelId=4050003700A3
	bool Rectangle( int x1, int y1, int x2, int y2 );
    
    //##ModelId=4050003700AB
	bool Rectangle( RECT *lprect );
    
    //##ModelId=4050003700B3
	bool Rectangle( CRect *lprect );
    
    //##ModelId=4050003700B5
	bool Ellipse( int x1, int y1, int x2, int y2 ); // no use
    
    //##ModelId=4050003700BE
	bool Ellipse( RECT *lpRect );
    
    //##ModelId=4050003700C0
	bool Ellipse( CRect *lpRect );
    
    //##ModelId=4050003700C2
	bool LineTo( int x, int y );
    
    //##ModelId=4050003700C9
	bool LineTo( POINT point );
    
    //##ModelId=4050003700CB
	bool LineTo( CPoint point );
    
    //##ModelId=4050003700CD
	CPoint MoveTo( int x, int y );
    
    //##ModelId=4050003700D3
	CPoint MoveTo( POINT point);
    
    //##ModelId=4050003700D5
	bool Polyline( CPoint *lpPoints, int nCount );
	
	//##ModelId=4050003700D5
	bool Polyline( POINT *lpPoints, int nCount );
 
 	//外面的边界不画,实际面积为(left,top,right - 1,bottom - 1)
 	//如果BRUSH是位图刷子,那么位图只能是单色的。它的颜色由前景色和背景色决定
 	//前景色和背景色 ,黑色,白色
    //##ModelId=4050003700DC    
	void FillRect( RECT *lpRect, CBrush* pBrush );

    //##ModelId=4050003700DF
    //外面的边界不画,实际面积为(left,top,right - 1,bottom - 1)
    //如果BRUSH是位图刷子,那么位图只能是单色的。它的颜色由前景色和背景色决定
	void FillRect( CRect *lpRect, CBrush* pBrush );

    //##ModelId=4050003700E5
    //外面的边界不画,实际面积为(left,top,right - 1,bottom - 1)
    //如果BRUSH是位图刷子,那么位图只能是单色的。它的颜色由前景色和背景色决定
	void FillRect( CRect Rect, CBrush* pBrush );

    //##ModelId=4050003700E8
	bool SetPixelV(int x, int y, COLORREF crColor);

    //##ModelId=4050003700F1
	bool SetPixelV( POINT point, COLORREF crColor );
 
    //##ModelId=4050003700F4
    COLORREF SetPixel(int x, int y, COLORREF crColor);

    //##ModelId=4050003700FB
    COLORREF SetPixel( POINT point, COLORREF crColor );
 
    //##ModelId=4050003700FE
    UGL_COLOR GetPixel( int x, int y );

    //##ModelId=405000370105
	UGL_COLOR GetPixel( POINT point ) ;
		
    //##ModelId=405000370107
	int SetBkMode( int nBkMode );
  
    //##ModelId=405000370109
	int GetBkMode();
  
    //##ModelId=40500037010E
	COLORREF SetBkColor( COLORREF crColor );
  
    //##ModelId=405000370110
	UGL_COLOR GetBkColor( );
	
    //##ModelId=405000370111
	UGL_COLOR GetTextColor( );
   
    //##ModelId=405000370112
	COLORREF SetTextColor( COLORREF crColor );
	
    //##ModelId=405000370115
	bool TextOut( int x, int y, LPCTSTR lpszString, int nCount );	
 
    //##ModelId=40500037011C
	bool TextOut( int x, int y, const CString& str );

    //##ModelId=405000370124
	bool TextOut (int x, int y, const char *pStr);
	
	//##ModelId=405000370124
	bool TextOutW (int x, int y, const char *pStr);
	
	int SelectClipRgn(CRgn* pRgn);
	
    //##ModelId=405000370130
	int SelectClipRgn( CRgn* pRgn, int nMode );
	
	bool DeleteObject();
		
private:
	//设置相关的设备环境
	//设置初始化的前景色和背景色,黑色,白色	
	void InitGC(UGL_GC_ID uglGcId);

public:

	//windml设备环境Id
	UGL_GC_ID m_uglGcId;
	
	//设备句柄
    //##ModelId=40501B860217
	UGL_DEVICE_ID m_uglDevId;
		
	//字体驱动器
	UGL_FONT_DRIVER_ID m_uglFontDrvId;
	

	//背景填充模式,透明,或者不透明
    //##ModelId=405000370045
	int m_nBkMode;
	
	//当前画线位置
    //##ModelId=405000370046
	CPoint m_nCurPosition;

	//当m_pBitmap = 0时,当前CDC是基于窗口,否则是基于CBitmap
    //##ModelId=40501B86028F
	CBitmap *m_pBitmap;	
		
	//当前的画刷
    //##ModelId=40501B8602A3
	CBrush *m_pCurBrush;
	
	//当前的字体
    //##ModelId=40501B8602AD
	CFont *m_pCurFont;
	
	//当前的画笔
    //##ModelId=40501B8602B7
	CPen *m_pCurPen;
	
};

//typedef CDC* HDC ;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -