[RESOLVED] Proper Canvas LineTo and MoveTo lazarus / 39-Graphics ---------------------------------------------------------------------- beefycoder · 2012-05-02 17:05 I would like to draw simple lines using coordinates retrieved from hardware source (about 15000 to 20000 true/false points per second) to display logic level (scope-like view). I chose TImage as simplest way of drawing while avoiding to draw directly to form itself. I used simple code that is invoked on click event (Image1 is TImage): Code: [Select]with Image1 do   begin     Canvas.Pen.Color := clWhite;     Canvas.Pen.Width := 1;     Canvas.Pen.Style := psSolid;     Canvas.MoveTo (0, 0);     Canvas.LineTo (100, 100);   end; I get the white line, but whole Canvas is filled with black color. I tried searching for methods that suppress this or at least set complete transparency, and here in forums too. There is no clear solution to this problem. So, how to write code that draws only lines without affecting background ? ---------------------------------------------------------------------- Avishai · 2012-05-02 17:12 Canvas.Clear; Canvas.Brush.Color:= clGreen; {what color you want} Canvas.Clear; ---------------------------------------------------------------------- beefycoder · 2012-05-02 17:52 Thanks ! I hope TImage will soon have this bug solved soon. ---------------------------------------------------------------------- Blaazen · 2012-05-02 19:43 @ (about 15000 to 20000 true/false points per second) I'm not sure if TImage.Canvas is enough fast for this but I know here are more graphicly-experienced people on this forum. Anyway, see this: http://wiki.freepascal.org/Fast_direct_pixel_access ---------------------------------------------------------------------- beefycoder · 2012-05-03 06:35 Direct access should work fine for this (as long as i dont' force my display to work at 15k frames/sec ) ---------------------------------------------------------------------- felipemdc · 2012-05-03 07:09 Quote from: beefycoder on May 02, 2012, 07:52:19 pmThanks ! I hope TImage will soon have this bug solved soon. There is no bug. By design all TImage requires that you draw the entire available area. Not only the minimum that you want. If you want to draw directly on the form use the TForm.OnPaint event ---------------------------------------------------------------------- User137 · 2012-05-03 09:05 If you really want performance, software rendering doesn't have the punch! You can look into OpenGL too. ---------------------------------------------------------------------- beefycoder · 2012-05-04 14:36 @felipemdc : So it's by design. @User137 : I was thinking backwards about the whole thing. The display does not need such high performance. Thanks for the all advice and help ! ---------------------------------------------------------------------- KpjComp · 2012-05-04 16:34 Have you looked at fpVectorial? You could create a TvVectorialPage, and place a TPaintBox on your form, paint with DrawFPVectorialToCanvas.