Recent

Author Topic: [solved] drawing with layers  (Read 632 times)

speter

  • Sr. Member
  • ****
  • Posts: 349
[solved] drawing with layers
« on: June 05, 2022, 08:29:54 am »
G'Day Folks,

I have written a program to draw on a number of layers; the program allows the user to show / hide layers and all that works okay.

What doesn't work is clearing the layer(s).

The layering is implemented by having multiple Timages with the transparent colour set; this works fine - first time around - but doesn't work when "erasing" the existing graphics...

I've attached the project and 2 images to show what I mean; in one image you see a number of coloured polygons; in the other the previous polygons are now black (the "transparent" colour).

Any help / suggestions would be very welcome! :)

cheers
S.
« Last Edit: June 05, 2022, 08:59:27 am by speter »
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

paweld

  • Hero Member
  • *****
  • Posts: 996
Re: drawing with layers
« Reply #1 on: June 05, 2022, 08:54:14 am »
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   a : byte;
  4.   b : TButton;
  5.   h,w : integer;
  6. begin
  7.   b := TButton(sender);
  8.   if b.caption = 'Draw' then
  9.     begin
  10.       for a := 1 to num_layers do
  11.         draw_layer(a);
  12.  
  13.       b.caption := 'Clear';
  14.     end
  15.   else
  16.     begin
  17.       w := image_layer1.Width;
  18.       h := image_layer1.Height;
  19.  
  20.       for a := 1 to num_layers do
  21.         layers[a].Picture.Clear; //<---------
  22.  
  23.       b.caption := 'Draw';
  24.     end;
  25. end;
Best regards / Pozdrawiam
paweld

speter

  • Sr. Member
  • ****
  • Posts: 349
Re: drawing with layers
« Reply #2 on: June 05, 2022, 08:59:04 am »
Thanks very much @ paweld.

cheers
S.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

 

TinyPortal © 2005-2018