Board index » delphi » About CAD and Double Buffer

About CAD and Double Buffer

Hi !

   I 'm trying to make CAD - like program ,but whatever I have tried to
improve my program (in the name of fastness)  so far , doesn't satisfy me
.I created DIBitmap and it is used as backbuffer and whenever  wm_paint is
sent to graphical component (descendant of TCustomControl ) backbuffer is
copied to canvas with BitBlt API    
,but before doing this I gotta clear all of the backbuffer and it seems
this takes much of the time of repainting ! When cursor moves the shape
follows it thus repainting is very slow .

Does any body can tell me ,what can I do get over the problem ?

Or am I violating all of the CAD -like program concept with creating
DIBitmap !

Thanks in advance !

 

Re:About CAD and Double Buffer


Hi Tanju:

I developed a GIS system that uses the double buffer scheme. I draw the map (several layers) to a
internal TBitmap (not a DIBitmap) and after finished the layer drawing I do a Canvas.draw(x,y,b),
where "b" are the buffer bitmap and the canvas belongs to a paint box, my map viewport. I point you
that the system performance are wonderful. We used this approach with machines from Pentium Pro 200
with 64mb ram and up to draw maps with all countries and cities in the world and we are quite happy,
and the customer is happy too :-)

A final observation: while drawing the map objects (points, lines and areas) we use only the GDI
api, we don't use any TCanvas drawing method, we take the Canvas handle and do all the hard work
throughout the GDI.

Re:About CAD and Double Buffer


On 1 Apr 2003 09:24:25 -0800, "Tanju ?zgr" <tanjuoz...@yahoo.com>
wrote:

Quote
>Hi !

>   I 'm trying to make CAD - like program ,but whatever I have tried to
>improve my program (in the name of fastness)  so far , doesn't satisfy me

I have made a 'CAD' program for building with virtual Lego bricks, and
have no big speed problems although I do all the painting in the
.OnPaint event of a TPaintBox. Models containing 3000-4000 3D blocks can
still be rotated in 'real time', and so on.

I draw everything to a bitmap (DIB) first, and then just blt it to the
paintbox canvas.

I did get a speedup by replacing Canvas .line, .polyline, .polygon with
code of my own (or rather Graphical Gems :-), drawing directly into the
DIB.

The source is available if you are interested, URL in sig.

--
Anders Isaksson, Sweden
BlockCAD: http://user.tninet.se/~hbh828t/proglego.htm
Gallery: http://user.tninet.se/~hbh828t/gallery/index.htm

Other Threads