How do I draw a shape with a hole in it?

How do I draw a blue square with a transparent round hole in the middle as shown below using Delphi and Firemonkey?

I want to do something like this:

transparent circle on blue surface

But I can't find a way to make the circle transparent :(

+3


source to share


1 answer


Something like this should do it:



var lPath: TPathData;
begin
  lPath := TPathData.Create;
  lPath.AddRectangle(RectF(0,0,100,100), 0,0, []);
  lPath.AddEllipse(RectF(20,20,80,80));
  Canvas.Fill.Color := $FF8080FF;
  Canvas.FillPath(lPath,1);
  lPath.Free;
end;

      

+3


source







All Articles