[Lazarus] Fastest way to draw
Brad Campbell
brad at wasp.net.au
Sun May 23 12:47:08 CEST 2010
Mattias Gaertner wrote:
>>
>> There has to be a faster way to get data to the screen in a cross-platform fashion (I'm developing
>> on Linux but ultimately I'll be compiled for OSX and Win32).
>
> Paint onto a memory image and then draw that.
>
> As memory image you can use TBitmap which has comfortable fonts, but
> is not the fastest.
>
So, taking into account your comment "is not the fastest" I thought I'd give a plain TBitmap a try.
It's by _far_ the fastest I've tried yet. So fast in fact that I really can't time it using
Millisecondsbetween(). Amazing.
I have 2 TBitmaps assigned globally. One I pre-prepare with my background (stuff, graticule and
other lines) every time there is a resize.
In the OnPaint() handler I copy the contents of the background TBitmap to the foreground TBitmap,
then draw a couple of thousand lines on it before copying it to the canvas of a panel (I'm using a
TPanel as the display component) using Panel.Canvas.Copy() to copy the canvas from the foreground
bitmap. I can't believe how fast it is.
Best of all, it requires no new components or packages :)
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