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

📄 cedraw.h

📁 windows mobile应用的图形库
💻 H
字号:
/* ---------------------------------------------------------------------------------------------------
 *  
 *                          Windows CE Graphics Libary v1.00.0000
 *  
 *        
 *    Written by James.
 *    Bug report : jiet@msn.com
 *                                                             Copyright 2001
 */
// File : CEDraw.h
// Graphics library head file.
//-----------------------------------------------------------------------------------------------------
//										Update Information.
//-----------------------------------------------------------------------------------------------------

/*
 * Created by James D. 2001.
 * Date: 01/11/2001
 */

#ifndef _CEDRAW_  // To Rrevent cycle including.
#define _CEDRAW_

#include "CEGraphics.h"
#include "CEGdiObject.h"

#define  MAX_TEXTSIZE 20

class CEGL_API CCEDraw : public CCEGraphics
{

public:
	CCEDraw();
	~CCEDraw();

public:
	/*
	 * Draw a Pixel.
	 */
	VOID DrawPixel( DWORD dwX, DWORD dwY, unsigned short Color );

	/*
	 * Draw the bitmap to the screen...
	 */
	BOOL DrawBitmap( CCEBitmap* pBitmap, int nXDest, int nYDest, int nWidth, int nHeight, int nXSrc, int nYSrc, DWORD dwRop, float fAlpha );

	/*
	 * Draw text to the screen
	 */
	BOOL DrawText( LPPOINT lpPoint, LPCTSTR lpString, int nCount, UINT uFormat );     // Use GDI
	BOOL DrawText( LPPOINT lpPoint, LPSTR lpString, int nCount, UINT uFormat );       // Use DirectDrawText

	/*
	 * This methods draws lines.
	 */
	BOOL DrawLine( POINT &ptOrig, POINT &ptDes );
	BOOL DrawLine( LONG lOrigX, LONG lOrigY, LONG lDestX, LONG lDestY );
	BOOL DrawHLine( LONG lOrigX, LONG lOrigY, LONG lDestX, LONG lDestY, short nColor = -1 );
	BOOL DrawVLine( LONG lOrigX, LONG lOrigY, LONG lDestX, LONG lDestY, short nColor = -1 );

	/*
	 * This method draws a polygon consisting of two or more points connected by lines. 
	 * The system closes the polygon automatically by drawing a line from the last vertex to the first.
	 */
	BOOL DrawPolygon( LPPOINT lpPoints, int nCount );
	BOOL DrawPolyline( LPPOINT lpPoints, int nCount );

	/*
	 * This method draws a polygon with the brush fill. 
	 * The system closes the polygon automatically by drawing a line from the last vertex to the first.
	 */
	BOOL FillPolygon( LPPOINT lpPoints, int nCount, int nOffsetX = 0, int nOffsetY = 0 );
	BOOL FillPolygon( FLOATPOINT* lpPoints, int nCount, int nOffsetX = 0, int nOffsetY = 0 );

	/*
	 * Draw a rectangle...
	 */
	BOOL DrawRect( LONG lStartX, LONG lStartY, LONG lEndX, LONG lEndY );
	BOOL DrawRect( RECT &rectDraw );

	/*
	 * Draw a filled rectangle.
	 */
	BOOL FillRect( LONG lStartX, LONG lStartY, LONG lEndX, LONG lEndY, FLOAT fAlpha = 1 );
	BOOL FillRect( RECT &rectDraw, FLOAT fAlpha = 1 );

	/*
	 * Clear the background with the pen or color.
	 */
	BOOL Clear( CCEPen* pPen );
	BOOL Clear( DWORD dwColor );

	/*
	 * Convect the COLORREF to CE support color
	 */ 
	unsigned short ConvertColor( COLORREF crColor );
	unsigned short ConvertColor( int nColorRed, int nColorGreen, int nColorBlue );

	/*
	 * FadeOut the screen.
	 */
	VOID FadeOut( DWORD dwStep );
	
	/*
	 * Select the GDI Object
	 */ 
	CCEGDIObject* SetGDIObject( CCEGDIObject* cegdiObject );
	/*
	 * Get the GDI Object
	 */
	CCEGDIObject* GetGDIObject( DWORD dwType );

	/*
	 * Get the Bitmap buffer color and translate it to the system color...
	 */
	unsigned short GetBitmapPointColor( unsigned char * pBuffer );

	/*
	 * Check the point in/Out side
	 */
	BOOL IsPointOutside( LONG lPointX, LONG lPointY ) 
	{ 
		if( lPointX < (LONG)m_gxdp.cxWidth - 1 && lPointY < (LONG)m_gxdp.cyHeight - 1 && lPointX >= 0 && lPointY >= 0 ) return FALSE;
		return TRUE; 
	}

protected:
	/*
	 * Check the point in/Out side
	 */
	BOOL IsAllPointInside( POINT* ptPoint, int nNumber );
	BOOL IsAllPointOutside( POINT* ptPoint, int nNumber );

	/*
	 * Test the font pixel color...
	 */
	int TestPoint( unsigned int a,int k );

public:
	CCEPen*   m_pPen;
	CCEBrush* m_pBrush;
	CCEFont*  m_pFont;

protected:
	LPBYTE   m_pFontFile;     // Pointer to the font file memory.
};

#endif // _CEDRAW_ 

⌨️ 快捷键说明

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