[Lazarus] Fastest way to draw
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri May 21 15:55:57 CEST 2010
On Fri, 21 May 2010 21:30:45 +0800
Brad Campbell <brad at wasp.net.au> wrote:
> G'day guys,
>
> I'm experimenting with an Oscilloscope at the moment.
> I'm using a TImage on a form, and I'm writing using Image.Canvas.Pen / Image.Canvas.Line.
>
> Each refresh consists of
>
> Image.Canvas.Clear()
> Repeat 20 -> Image.Canvas.Line(draw graticule)
> Repeat Width -> Image.Canvas.Line(draw CH1 sample)
> Repeat Width -> Image.Canvas.Line(draw CH2 sample)
>
> So there are _lots_ of little fiddly bits to draw (about 1200 line segments per refresh).
>
> 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.
Or you can use fpcanvas (it comes with fpc). See here
http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Drawing_without_LCL
You can tune it quite a lot.
If you use lazarus 0.9.29 you can use aggpas. The package can be found
in lazarus/components/aggpas. For examples in
components/aggpas/lazarus/example/AggPasInLCLDemo1.lpi.
Aggpas is completely written in pascal, quite fast and the results are
the same on all platforms (as always: fonts are a problem).
And finally you can use opengl - for example via the TOpenglControl.
> Has anyone done anything similar?
No. You are the first.
Mattias
More information about the Lazarus
mailing list