65.9K
CodeProject is changing. Read more.
Home

Drawing with DirectDraw & GDI

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.88/5 (10 votes)

May 25, 2002

viewsIcon

303838

downloadIcon

13875

Drawing Graphics fast with DirectDraw than with GDI

Sample Image - Drawing.jpg

Sample Image - Drawing1.jpg

Software required to build the project:

  1. Visual C++ 6.0
  2. Direct X 7.0 SDK

Software required to run the Demo:

  1. DirectX 7.0
  2. Windows 2000 or Win 9x
  3. The system color must be 32 bits

Introduction

Drawing is a DLL to develop graphics software and games. You can use it to display standard image formats (BMP, Jpeg, Png, tiff...). Also you can draw normal graphics (line, circle, rectangle...) with it. Drawing has a trait that change the draw engine at any moment. You can draw something with DirectDraw or GDI, certainly DirectDraw is faster and better than GDI.

The code

Drawing DLL consists of the following classes:

  1. CCanvas
  2. CCanvasImpl
  3. CDDCanvasImpl
  4. CGDICanvasImpl
  5. NDDSCreen
  6. NDDSurface
  7. CMemDC

Drawing DLL class structure:

Sample Image - Drawing.jpg

Note

When you use Drawing DLL, you can Create a CCanvas object and do your drawing work with it.

At last you use canvas.refresh() to draw the screen.