ImageEn, unit ievect

TImageEnVect.CreatePolygonFromEdge

TImageEnVect.CreatePolygonFromEdge


Declaration

function CreatePolygonFromEdge(x, y: integer; maxfilter: boolean; tolerance: integer): integer;


Description

CreatePolygonFromEdge creates a closed polyline (polygon) making a flood fill starting from x, y point.

Set maxfilter to True to apply a maximum filter that removes noise. tolerance specifies the color difference between starting pixel and testing pixel.
CreatePolygonFromEdge returns the object index just created. The kind of the new object is iekPOLYLINE.

This method is useful to create a polygon following the image's edges.


Example

// creates a new polygon when user presses left mouse button over the image
procedure TForm1.ImageEnVect1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  hobj: integer;
begin
  hobj := ImageEnVect1.CreatePolygonFromEdge(X, Y, true, 25);
  ImageEnVect1.ObjPenColor[hobj] := clRed;
end;


Transition Information

If you are transitioning your code to TImageEnView Layers, instead of CreatePolygonFromEdge, use: TImageEnView.LayersCreateFromEdge

ImageEnView1.LayersCreateFromEdge();