[Lazarus] Fastest way to draw
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun May 23 20:12:12 CEST 2010
On Sun, 23 May 2010 18:47:08 +0800
Brad Campbell <brad at wasp.net.au> wrote:
> 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.
Indeed.
Can you provide the benchmark source?
> 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 :)
:)
Mattias
More information about the Lazarus
mailing list