[Lazarus] Fastest way to draw

Brad Campbell brad at wasp.net.au
Sat May 22 13:28:20 CEST 2010


Duncan Parsons wrote:

> There's GR32 as well, which now has FPC/Laz compatibility.
> http://www.graphics32.org/
> 
> Overall, the best way to do that sort of thing is to have a bitmap in
> memory (either loaded from a file, or drawn on application start) then
> when doing what's needed copy/draw the background, then draw the
> additional lines. I've done this sort of thing in realtime in audio/VST
> programming, sometimes using Peter Morris's DIB controls, and sometimes
> GR32. AggPas has come on since I last tried it a few years ago, and
> could also be a good choice as suggested.

Just as a follow up. Rendering to a 1600x1200 screen, timing was along these lines;

TImage.Canvas : 200ms / frame

Clear / draw all lines


AggLCLCanvas : 90ms / frame

Clear / draw all lines / copy to TImage

AggLCLCanvas was taking 30ms just to do a clear. Using a filled rectangle with the desired 
background colour took only 10ms by comparison.


RGBBitmap32 : 19ms / frame

Clear / draw all lines / render to TPanel.Canvas (and update in onpaint event as required).

For the simple stuff I'm doing (no text and just lines) LazRGBGraphics goes like a bat out of hell.

I tried using fpimage and an fpcanvas but nothing I tried could render them to any visual component 
(Not that I tried very hard after trying LazRGBGraphics - it's *fast*)

AggPas was pretty quick, and if I needed the additional fruit it'd probably be a great choice, but 
for just slapping lines down on a canvas LazRGBGraphics is hard to beat.

Regards,
Brad.
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.




More information about the Lazarus mailing list