Recent

Author Topic: [Bug?] changing canvas.pen.mode has no effect  (Read 8634 times)

nhaider

  • Newbie
  • Posts: 4
[Bug?] changing canvas.pen.mode has no effect
« on: August 27, 2004, 02:10:48 pm »
Hi,

being rather new to Lazarus, I stumbled across a severe problem when I tried to port an app from Delphi/Kylix to Lazarus:

any attempt to change the pen.mode property of a canvas (in my case,
a paintbox.canvas) to e.g. pmNotXOR had no effect, it remained pmCopy
all the time. However, pmNotXOR would be essential for creating an interactive graphics app with "rubber-banding" lines etc.

The code snippet below should produce two crossed lines (one in black, the
other one in blue) on my paintbox1.canvas, and the intersection should be
yellow (as in Delphi/Kylix), but whatever I set pen.mode to, the intersection is always blue (==> pen.mode still pmCopy). Therefore, it seems impossible to erase a line and restore the original pixels by drawing this line a second time with penmode pmNotXOR.

My Lazarus version is 0.9.2-beta (Linux), the same happens in the Win32 version.

Any ideas anyone?

Thanks in advance,
Norbert

-------------------------------------------------------

procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
  with paintbox1.canvas do
    begin
      pen.width := 10;
      pen.color := clBlack;
      pen.mode  := pmCopy;  // not really necessary, this is the default
      moveto(10,10);
      lineto(200,100);
      pen.color := clBlue;
      pen.mode  := pmNotXOR;  // this has no effect!
      moveto(200,10);
      lineto(10,100);
    end;
end;

 

TinyPortal © 2005-2018