ImageEn, unit imageenview

TImageEnView.CalcSelectionArea

TImageEnView.CalcSelectionArea

Declaration

function CalcSelectionArea(Units: TIEUnits = ieuPixels): double;

Description

Returns the area of current selection.

Note:
Result will be inaccurate for intersected areas
Works with all selection types, including selection masks
For units other than ieuPixels, the value will be calculated using the image DPI

Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Example

// Show statistics while making a selection
procedure TfrmMain.ImageEnView1SelectionChanging(Sender: TObject);
const
  Units = ieuPixels;
var
  uS: string;
begin
  uS := IEGlobalSettings().MeasureUnits[ Units ];

  Label1.Caption := format( 'Area: %.2f %sē', [ ImageEnView1.CalcSelectionArea( Units ), uS ]);
  Label2.Caption := format( 'Perimeter: %.2f %s',[ ImageEnView1.CalcSelectionLen( Units ), uS ]);
  Label3.Caption := format( 'Centroid: %d,%d', [ ImageEnView1.CalcSelectionCentroid.X, ImageEnView1.CalcSelectionCentroid.Y ]);
end;

See Also

CalcSelectionCentroid
CalcSelectionLen
MeasureUnits