?? cegraph.htm
字號:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Introduction WinCE High Speed Graphics Library</title>
</head>
<body bgcolor="#FFFFFF">
<p><font face="Times New Roman"><b><font size="4">Introduction</font></b><br>
<br>
CEDraw is high speed graphics library in WinCE . it’s depend on GAPI .<br>
This code was writen in C++ and using embedded VC++ to complie it. Testing in
iPaq h3600 with WinCE 3.0.<br>
CEDraw use double buffer and direct write video buffer technology to enhance
Draw speed. With own graphics arithmetic, the draw speed is much more faster
than WinGDI.<br>
<br>
CE Draw support those function:<br>
<br>
<font color="#FF0000">Draw Pixel<br>
Fill Screen<br>
Draw Line,HLine,VLine<br>
Draw Polyline<br>
Draw Polygon<br>
Draw Rectangle<br>
Fill Rectangle ( with alpha blend support )<br>
Fill Polygon<br>
Draw Bitmap ( Support Bmp,Gif,Jpg format, Support alpha blend )<br>
Draw Text ( Own font file, support Chinese, support gdi text )</font><br>
<br>
SDKSample Screen Shot:(screenshot.jpg)<br>
<img border="0" src="ScreenShot.jpg" width="268" height="399"><br>
<br>
<b><font size="4">How to using it</font></b><br>
<br>
Before use the CEDraw Library, you must copy some support file in you system.<br>
<br>
a. Copy the dll to you WinCE system directory<br>
(1) If using in emulation system,copy two of the <font color="#FF0000">dll in …\CEGraph\DLL\X86Em
directory ( gx.dll & cegl.dll)</font> to<br>
emulation windows system directory, always in D:\Windows CE Tools\wce300\MS
Pocket PC\emulation\palm300\windows<br>
Then copy the file <font color="#FF0000">Hzk16 which in …\CEGraph\Res directory
to the WinCE Root directory.</font><br>
Always in D:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300<br>
<br>
(2) if Using in Arm system,copy two fo the <font color="#FF0000">dll in …\CEGraph\DLL\Arm
( gx.dll & cegl.dll) to Pocket PC windows system directory.</font><br>
Then copy the file <font color="#FF0000">HZK16 to the System Root directory.</font><br>
<br>
<br>
There a 4 step to use it:<br>
<br>
<b>Step 1 Directory:</b><br>
<br>
Set the including directory to …\CEGraph\Include<br>
And lib directory to …\CEGraph\Lib\X86Em ( if using in emulation system)<br>
Or …\CEGraph\Lib\Arm ( if using in pocketpc)<br>
</font></p>
<p><font face="Times New Roman">Open the project setting->Link->Object/library
Modules </font></p>
<p><font face="Times New Roman"><font color="#FF0000">Add CEGL.lib</font><br>
<br>
<b>Setp 2 Head file Including:</b><br>
Include the cedraw graphics header file: CEGL.h<br>
<br>
#include "stdafx.h"<br>
#include "SDKSample.h"<br>
#include <commctrl.h><br>
<br>
<font color="#FF0000">#include <cegl.h> // Include CE Graphics library</font><br>
<br>
<b>Step 3 Create the CE Draw Class:</b><br>
<br>
// Create the CE Draw Object:<br>
<font color="#FF0000">CCEDraw m_ceDraw; </font><br>
<br>
// Initlizate after CreateWindow()<br>
<br>
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)<br>
<br>
{<br>
HWND hWnd;<br>
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text<br>
TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name<br>
<br>
hInst = hInstance; // Store instance handle in our global variable<br>
// Initialize global strings<br>
LoadString(hInstance, IDC_SDKSAMPLE, szWindowClass, MAX_LOADSTRING);<br>
MyRegisterClass(hInstance, szWindowClass);<br>
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);<br>
hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,<br>
<font color="#FF0000">0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)</font>, NULL, NULL, hInstance, NULL);<br>
if (!hWnd)<br>
{ <br>
return FALSE;<br>
}<br>
<br>
<font color="#FF0000">// Create the CE Grahpics Library<br>
m_ceDraw.Create( hWnd );</font><br>
<br>
ShowWindow(hWnd, nCmdShow);<br>
UpdateWindow(hWnd);<br>
<br>
return TRUE;<br>
}<br>
<br>
<b>Step 4: Using CE Draw freely</b><br>
<br>
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<br>
{<br>
HDC hdc;<br>
int wmId, wmEvent;<br>
PAINTSTRUCT ps;<br>
TCHAR szHello[MAX_LOADSTRING];<br>
<br>
switch (message) <br>
{<br>
case WM_PAINT:<br>
RECT rt;<br>
hdc = BeginPaint(hWnd, &ps);<br>
GetClientRect(hWnd, &rt);<br>
LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);<br>
DrawText(hdc, szHello, _tcslen(szHello), &rt, <br>
DT_SINGLELINE | DT_VCENTER | DT_CENTER);<br>
EndPaint(hWnd, &ps);<br>
<br>
<font color="#FF0000">Render(); // Render screen</font><br>
break;<br>
……………………………<br>
}<br>
}<br>
<br>
<font color="#FF0000">void Render( void )<br>
{<br>
POINT pt[5] ={ { 140, 100 }, { 70,120 }, { 104, 150 }, { 210, 122 }, { 75, 200 }
};<br>
<br>
</font>// Create the ce pen object...<font color="#FF0000"><br>
CCEPen cePen;<br>
cePen.CreatePen( 1, 1, m_ceDraw.ConvertColor( 255, 0, 0 ) ); </font>// Convert RGB
color to CE support Color<font color="#FF0000"><br>
<br>
</font>// Select it to the graphics system
<font color="#FF0000"> <br>
m_ceDraw.SetGDIObject( &cePen );<br>
<br>
</font>// Create the ce brush object...<font color="#FF0000"><br>
CCEBrush ceBrush1, ceBrush2;<br>
ceBrush1.CreateBrush( 1, m_ceDraw.ConvertColor( 200, 200, 100 ), 1 );<br>
ceBrush2.CreateBrush( 1, m_ceDraw.ConvertColor( 0, 240, 0 ), 1 );<br>
<br>
</font>// Select it to the graphics system
<font color="#FF0000"> <br>
m_ceDraw.SetGDIObject( &ceBrush1 );<br>
<br>
</font>// Begin Draw<font color="#FF0000"><br>
m_ceDraw.BeginDraw();<br>
m_ceDraw.Clear( (DWORD)255 ); </font>// Clear screen use white color<font color="#FF0000"><br>
<br>
m_ceDraw.DrawLine( 1, 1, 100, 100 ); </font>// Draw line<font color="#FF0000"><br>
<br>
m_ceDraw.DrawRect( 10, 10, 110, 80 );</font> // Draw Rect<font color="#FF0000"><br>
<br>
m_ceDraw.FillRect( 30, 30, 50, 50 ); </font>// Fill Rect<font color="#FF0000"><br>
<br>
m_ceDraw.SetGDIObject( &ceBrush2 ); </font>// Select another color brush<font color="#FF0000"><br>
m_ceDraw.FillRect( 40, 40, 100, 100, 0.4 ); </font>// fill Rect with alpha blend<font color="#FF0000"><br>
<br>
m_ceDraw.FillPolygon( pt, 5 ); </font>// Draw an polygon<font color="#FF0000"><br>
m_ceDraw.SetGDIObject( &ceBrush1 );</font> // Select another color brush<font color="#FF0000"><br>
m_ceDraw.FillPolygon( pt, 5, 40, 40 ); </font>// Draw an polygon
<font color="#FF0000"> <br>
<br>
CCEBitmap ceBmp1,ceBmp2;<br>
ceBmp1.LoadBitmap( &m_ceDraw, L"windows\\wcelogo1.gif" ); </font>
// Load Gif picture from file<font color="#FF0000"><br>
ceBmp2.LoadBitmap( &m_ceDraw, L"windows\\welcomehead.gif" );<br>
ceBmp2.BitBlt( &m_ceDraw, 1, 80, 0, 0, 0, 0, SRCALPHA, 0.6f ); </font>// Draw bitmap
with alpha blend<font color="#FF0000"><br>
ceBmp1.BitBlt( &m_ceDraw, 1, 200, 0, 0, 0, 0, SRCALPHA, 0.6f );<br>
<br>
POINT ptText = { 1, 300 };<br>
m_ceDraw.DrawText( &ptText, "Hello CE Graph!", 16, 1 ); </font>// Draw text with pen
color<font color="#FF0000"><br>
<br>
</font>// End Draw<font color="#FF0000"><br>
m_ceDraw.EndDraw();<br>
m_ceDraw.Flip(); </font>// Flip the back buffer to the video buffer<font color="#FF0000"><br>
}</font><br>
<br>
<br>
<br>
<b>Step 5:</b><br>
<br>
Don’t forgot to release it:<br>
</font></p>
<p><font face="Times New Roman">case WM_DESTROY:<br>
<font color="#FF0000"> m_ceDraw.Release();</font><br>
PostQuitMessage(0);<br>
break; <br>
<br>
<b><font size="4">Tips: </font></b><br>
This graphics can not be directly used in MFC appwizard generated frame. Because
it has two window, One is frame window, the other is child Window.<br>
I’v write a Frame Code that support MFC. If anyone who want to use it in mfc.
Write mail to me.<br>
</font></p>
<ul>
<li><font face="Times New Roman">The <font color="#FF0000">CEGLDLLPrj </font>
is the dll project of CE Graphics Library. It's high recommand that if you
want to use this library, use the project to build your</font></li>
</ul>
<p><font face="Times New Roman">own DLL & Lib Files. To Build this project. You
Can setting the include directory and lib directory with ...\CEGraph\include &
lib(The same as Step 1 Directory )</font></p>
<ul>
<li><font face="Times New Roman">The <font color="#FF0000">SDKSample</font>
Project is the sample NOT using MFC. Build it aftet setting & copying the
library&Dll Files.</font></li>
</ul>
<p><font face="Times New Roman">
<br>
<b><font size="4">Comments</font></b><br>
Please report any bugs or feedback to <a href="mailto:jiet@msn.com">jiet@msn.com</a><br>
<br>
<b><font size="4">Thanks</font></b><br>
<br>
This Code using GAPI Enum. Thanks to the Writer.<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font></p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -