Re: Paint a graph

From: Fabian Schmied (REMOVETHISfabianDOTschmied_at_fhs-hagenbergDOTacDOTat)
Date: 05/12/04


Date: Thu, 13 May 2004 00:54:29 +0200

maka3 schrieb:

> Thanks for your answers. I have decided to take bitmaps for the
> circles, it's faster. Can you explain me why?

Because DirectDraw can do BitBlts (bit block transfers, i.e. copying
bitmaps) itself, very fast, usually hardware-accelerated. The other
Draw... methods are performed by GDI. That means, an HDC is requested
for the surface, GDI is used to draw the object, the HDC is released.
Both the HDC request and the GDI drawing are slow, so using bitmaps (or
actually, other surfaces) for drawing is faster.

> How would you draw a graph? Is there another way as saving all
> coordinates in a collection and call DrawLine for each pair?

Yes, I'd probably do it that way. Although it may be more efficient to
call GetDC() once and p/invoke Polyline.

Fabian