Browse Source

+ added Erase method to TFPCustomCanvas to erase (with zeros) the image

mazen 22 years ago
parent
commit
7594243fbb
2 changed files with 10 additions and 0 deletions
  1. 9 0
      fcl/image/fpcanvas.inc
  2. 1 0
      fcl/image/fpcanvas.pp

+ 9 - 0
fcl/image/fpcanvas.inc

@@ -372,6 +372,15 @@ begin
     end;
     end;
 end;
 end;
 
 
+procedure TFPCustomCanvas.Erase;
+var
+  x,y:Integer;
+begin
+  for x:=0 to Width-1 do
+    for y:=0 to Height-1 do
+      Colors[x,y]:=colTransparent;
+end;
+
 procedure TFPCustomCanvas.DoRectangleAndFill (const Bounds:TRect);
 procedure TFPCustomCanvas.DoRectangleAndFill (const Bounds:TRect);
 begin
 begin
   DoRectangleFill (Bounds);
   DoRectangleFill (Bounds);

+ 1 - 0
fcl/image/fpcanvas.pp

@@ -229,6 +229,7 @@ type
     // other procedures
     // other procedures
     procedure CopyRect (x,y:integer; canvas:TFPCustomCanvas; SourceRect:TRect);
     procedure CopyRect (x,y:integer; canvas:TFPCustomCanvas; SourceRect:TRect);
     procedure Draw (x,y:integer; image:TFPCustomImage);
     procedure Draw (x,y:integer; image:TFPCustomImage);
+    procedure Erase;virtual;
     // properties
     // properties
     property Font : TFPCustomFont read GetFont write SetFont;
     property Font : TFPCustomFont read GetFont write SetFont;
     property Pen : TFPCustomPen read GetPen write SetPen;
     property Pen : TFPCustomPen read GetPen write SetPen;