Hello,
I am new in FPC and want to understand the correct(fastest) methods when
drawing 2D graphics.
The task is simple but extensive: to draw about 200 polylines with 50000-200000
points in each.
I have made a test code in OnPaint event:
...
type
TSingleArray = array of single;
TIntArray = array of integer;
TIntArrayArray = array of TIntArray;
procedure TForm1.FormPaint(Sender: TObject);
var
cb, cb2, iShift: integer;
Times: TSingleArray;
FileDetections: TIntArrayArray;
begin
canvas.Pen.Color:=clBlue;
for cb := 0 to High(FileDetections) do
begin
iShift := round(Self.Height - cb * Self.Height / High(FileDetections));
canvas.MoveTo(0, iShift);
for cb2 := 0 to High(FileDetections[cb]) do
canvas.LineTo(round(Times[cb2] * Width/15), round(FileDetections[cb,
cb2]/20) + iShift);
end;
end;
...
It works fine (png is attached).
Then I'd like to add some actions to the graphics:
1)Scaling around some point (by mouse wheel), actually magnifying
2)Moving this scaled point quickly to another part of graphics( using scroll
bars?)
The main question is:
1)How to correctly organize this drawing that it'll take a lot of time only
once before the first display?
Later actions (scaling and moving) should be as fast as possible provided that
points array (Times and FileDetections)
are not changed.
Ravil
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal