ImageEn, unit imageenview

TImageEnView.AddSelCurve

TImageEnView.AddSelCurve


Declaration

procedure AddSelCurve(EndX, EndY: Integer; RadiusMult: Double; PtCount: Integer = 50);


Description

Adds a series of points to form a curved selection from the previous selection point to EndX, EndY.
RadiusMult is a multiplier to increase or decrease the radius of the curve. 1: Creates a curve of an exact half circle. >1 creates a shallower curve. <1 creates a bulging curve. Pass as negative to make sweep clockwise
If SelectionBase is iesbClientArea (default), all coordinates depend upon actual zoom and scrolling.
Otherwise, if SelectionBase is iesbBitmap all coordinates refer to bitmap pixels.

Use EndSelect to terminate selection by code.


Example

// Create a wavy lined selection
const
  WAVE_HEIGHT = 0.4; // Wave selection is 40% height of image
  CURVE_COUNT = 6;   // Number of up and down curves
  CURVE_MULT  = 2.4; // How curved is the line? 1=half circle
var
  waveHt, i: Integer;
  waveWidth, curve, endX: Double;
begin
  ImageEnView1.Deselect();
  ImageEnView1.SelectionBase := iesbBitmap;

  waveHt    := Round( ImageEnView1.IEBitmap.Height * WAVE_HEIGHT );
  waveWidth := ImageEnView1.IEBitmap.Width / CURVE_COUNT;

  ImageEnView1.AddSelPoint( 0, 0 );
  ImageEnView1.AddSelPoint( 0, waveHt );

  curve := CURVE_MULT;
  endX := 0;
  for i := 1 to CURVE_COUNT do
  begin
    endX := endX + waveWidth;
    ImageEnView1.AddSelCurve( Round( endX ), waveHt, curve );
    curve := -1 * curve;   // reverse direction of curve
  end;

  ImageEnView1.AddSelPoint( ImageEnView1.IEBitmap.Width, 0 );
  ImageEnView1.EndSelect();
end;




See Also

AddSelBreak
AddSelPoint
DelLastSelPoint
EndSelect
PolySel
PolySelPoints