, Delphi, . , "" . , . , - :
function BlockPath(Path: IGPGraphicsPath): IGPGraphicsPath;
var
PathIterator: IGPGraphicsPathIterator;
SubPath: IGPGraphicsPath;
I: Integer;
IsClosed: Boolean;
BiggestPath: IGPGraphicsPath;
BiggestRect, BoundsRect: TGPRectF;
begin
Result := TGPGraphicsPath.Create;
SubPath := TGPGraphicsPath.Create;
PathIterator := TGPGraphicsPathIterator.Create(Path);
PathIterator.Rewind;
BiggestPath := nil;
BiggestRect.Width := 0;
BiggestRect.Height := 0;
for I := 0 to PathIterator.SubpathCount - 1 do
begin
SubPath.Reset;
PathIterator.NextSubPath(SubPath, IsClosed);
SubPath.GetBounds(BoundsRect);
if (BoundsRect.Width >= BiggestRect.Width) and
(BoundsRect.Height >= BiggestRect.Height) then
begin
BiggestRect := BoundsRect;
BiggestPath := SubPath.Clone;
end;
end;
if BiggestPath <> nil then
begin
Result.AddPath(BiggestPath, True);
end;
end;
.