ImageEn, unit imageenview

TImageEnView.CalcSelectionCentroid

TImageEnView.CalcSelectionCentroid


Declaration

function CalcSelectionCentroid(): TPoint;


Description

Calculates the coordinates of the selection's centroid (in bitmap coordinates).
The centroid is the geometric center of a shape, i.e. the mean position of all the points in the figure.

Note: Works with all selection types, including selection masks


Example

procedure TMDIChild.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  Label1.Caption := 'Area: ' + IntToStr( Round( ImageEnView1.CalcSelectionArea() ));
  Label2.Caption := 'Perimeter: ' + IntToStr( Round( ImageEnView1.CalcSelectionLen() ));
  Label3.Caption := 'Centroid: ' + IntToStr( ImageEnView1.CalcSelectionCentroid.X ) + ',' + IntToStr( ImageEnView1.CalcSelectionCentroid.Y );
end;


See Also

CalcSelectionArea
CalcSelectionLen