瀏覽代碼

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

mazen 22 年之前
父節點
當前提交
7594243fbb
共有 2 個文件被更改,包括 10 次插入0 次删除
  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;
 
+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);
 begin
   DoRectangleFill (Bounds);

+ 1 - 0
fcl/image/fpcanvas.pp

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