ImageEn, unit imageenview

TImageEnView.EndSelect

TImageEnView.EndSelect


Declaration

procedure EndSelect();


Description

Terminates a selection specified by code using the AddSelPoint and AddSelBreak methods.


Examples

// Create a polygon selection from an array of TPoints
for I := Low( MyPolySelArray ) to High( MyPolySelArray ) do
  ImageEnView1.AddSelPoint( MyPolySelArray[ I ].x, MyPolySelArray[ I ].y );
ImageEnView1.EndSelect();

// Add a triangular selection
ImageEnView1.Deselect();
ImageEnView1.AddSelPoint( 200, 100 );
ImageEnView1.AddSelPoint( 300, 200 );
ImageEnView1.AddSelPoint( 100, 200 );
ImageEnView1.EndSelect();

// Select a pentagonal area of the image and save it to PNG (with transparent background)
const
  PENT_X1 = 0.21; PENT_Y1 = 0.41;
  PENT_X2 = 0.32; PENT_Y2 = 0.74;
  PENT_X3 = 0.68; PENT_Y3 = 0.74;
  PENT_X4 = 0.79; PENT_Y4 = 0.41;
  PENT_X5 = 0.50; PENT_Y5 = 0.20;
var
  bmp: TIEBitmap;
  bw, bh: Integer;
begin
  ImageEnView1.SelectionBase := iesbBitmap;

  bw := ImageEnView1.IEBitmap.Width;
  bh := ImageEnView1.IEBitmap.Height;

  ImageEnView1.AddSelPoint( Round( PENT_X1 * bw ), Round( PENT_Y1 * bh ));
  ImageEnView1.AddSelPoint( Round( PENT_X2 * bw ), Round( PENT_Y2 * bh ));
  ImageEnView1.AddSelPoint( Round( PENT_X3 * bw ), Round( PENT_Y3 * bh ));
  ImageEnView1.AddSelPoint( Round( PENT_X4 * bw ), Round( PENT_Y4 * bh ));
  ImageEnView1.AddSelPoint( Round( PENT_X5 * bw ), Round( PENT_Y5 * bh ));
  ImageEnView1.EndSelect();

  bmp := TIEBitmap.Create();
  ImageEnView1.CopySelectionToBitmap( bmp, False );
  bmp.Write( 'D:\PentagonalSelection.png' );
  bmp.free;
end;