Erase

procedure Erase(img: TImage32; const polygon: TArrayOfPointD; fillRule: TFillRule; inverted: Boolean = false); overload;

procedure Erase(img: TImage32; const polygons: TArrayOfArrayOfPointD; fillRule: TFillRule; inverted: Boolean = false); overload;


Erases whatever is inside the supplied polygon regions, unless inverted. When inverted, Erase will clear the entire image except inside the supplied polygon regions.

Note: When not inverted this procedure performs identically to Image32_Draw.ErasePolygon

uses Image32, Image32_PNG, Image32_Extra;
...
var
  img: TImage32;
  path: TArrayOfPointD;
begin
  img.LoadFromFile('./lenna.png');
  path := Ellipse(Rect(20,20,236,236));
  Erase(img, path, frNonZero);
  img.SaveToFile('erase_center.png');
  img.Free;
end;
      
Before:
After:

  uses Image32, Image32_PNG, Image32_Extra;
  ...
  var
    img: TImage32;
    path: TArrayOfPointD;
  begin
    img.LoadFromFile('./lenna.png');
    path := Ellipse(Rect(20,20,236,236));
    Erase(img, path, frNonZero, true);
    img.SaveToFile('erase_outer.png');
    img.Free;
  end;
      
Before:
After:

See Also

ErasePolygon