Felipe Monteiro de Carvalho wrote:
Thanks, but the Osciloscope is being implemented on an ISA card and
such BUS only exists on old computers. The GUI will be running on
something like a Pentium 233 Mhz, but I may even try to get it running
on older computers, so no OpenGL ;)
The idea of creating a custom control seams very good. Can it really
improve the drawing speed? why?
About the drawing function, I won't use anything fancy. My tasks are
more programming oriented than graphics oriented, like finding the
Fourier Series of the wave and drawing it. It's just a plotting of
many dots and lines. Curves can be made with the dots and lines.
I used fmod a while back and it has the ability to output VU levels. I
just put the paint methods in a timer event and used a TPanel to draw
on. I'm not sure if this would work for you.
I used the Canvas.LineTo procedure and I found that the most efficient
way overall to draw the line was to only draw the differences.
Example:
Assume the max value is 100
If the old value is 40 and the new value is 65 then
Panel.Canvas.Pen.Color := clRed;
Panel.Canvas.MoveTo(X, 40);
Panel.Canvas.LineTo(X, 65);
If the old value is 70 and the new value is 32 then
// Draw the line from the old value to the new value, but use the Panel
color so the line is "erased"
Panel.Canvas.Pen.Color := Panel.Color;
Panel.Canvas.MoveTo(X, 70);
Panel.Canvas.LineTo(X, 32);
Anyway I found this to work the best for me.
HTH
Andrew
Another example:
var
OldYValues: Array [0..10] of Integer;
procedure TForm1.Timer(Sender: TObject);
var
X: Integer;
NewValue: Integer;
PaintColor := TColor;
begin
for X := 0 to 10 do begin
NewValue := GetNewYValueFromX(X);
if NewValue < OldYValues[X] then
PaintColor := clRed
else
PaintColor := Panel.Color;
Panel.Canvas.Pen.Color := PaintColor;
Panel.Canvas.MoveTo(X, OldYValues[X]);
Panel.Canvas.LineTo(X, NewValue);
OldYValues[X] := NewValue;
end;
end;
TForm1.Panel1Paint(Sender: TObject); // Panels OnPaint Event
var
X: Integer;
begin
for X := 0 to 10 do OldYValues[X] := 0;
end;
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives