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%s', [ ImageEnView1.CalcSelectionArea( Units ), uS, #178 ]);
  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