On 9/29/05, Felipe Monteiro de Carvalho
<[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm developing an osciloscope gui with Lazarus, so I need to draw very
> basic graphics (just lines to being with) to show the wave format.
>
> I have lots of dots that the hardware sends me (500 of them). What
> component should I put on my form to draw on it's canvas? TImage or
> TPaintBox? That is the difference between them?
>
> I've being trying without success since monday ... Can someone provide
> me an very basic example that will just draw 10 lines on an white empty
> drawing space??
>
> I could not find a very basic graphical example on the examples folder
> ... maybe I can add one after I get this stuff working...
>
> I thought I could just write to the canvas, and everything would be ok.
> I put a TImage on my form, added a OnPaint event to it and wrote:
>
> procedure TForm1.TelaPaint(Sender: TObject);
> var
> Bitmap: TBitmap;
> x, y: Integer;
> begin
> Bitmap := TBitmap.Create;
> try
> Bitmap.PixelFormat := pf24bit;
>
> Bitmap.Canvas.Pen.Color := clBlack;
> Bitmap.Canvas.MoveTo(0, 0);
> for x := 0 to 499 do
> begin
> y := Medidas[x];
> Bitmap.Canvas.LineTo(2 * x,y);
> end;
>
> Tela.Canvas.Draw(0, 0, Bitmap);
> finally
> Bitmap.Free;
> end;
> end;
>
> Medidas[0..499] is an array of words that contains values that describes
> the dots that come from the hardware.
>
> I see nothing on my TImage, eventhougth Medidas contains values like: 0,
> 4, 5,7,9,12,14,15,19,23,32,...
>
> thanks,
>
> Felipe
I would not use any graphic control to do fast drawing but instead a
window based control such as TPanel or create my own with an internal
canvas, however for making an Osciloscope i would certainly use
dedicated libraries such as SDL or OpenGL, you may try the GLScene
components, with this kind of libs you can easily get hundreds of
frames and they are not so bad to setup, not to mention that you have
specific drawing funcs for various shapes and all kinds of goodies and
they are CrossPlatform you can even use a Panel to render using
OpenGL.
Razvan
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives