ImageEn, unit imageenview

TImageEnView.SelectionBase

TImageEnView.SelectionBase


Declaration


property SelectionBase: TIESelectionBase;


Description


Specifies the meaning of coordinates used when creating a selection.
If SelectionBase is iesbClientArea, then all coordinates depend upon the actual zoom and window view/scrolling (i.e. pixels on screen). Otherwise, if SelectionBase is iesbBitmap, then all coordinates refer to bitmap pixels.

Default: iesbClientArea

Note: Specify before creating a selection. It has no effect on existing selections.


Examples


// Select a 100 pixel square in the top left corner of the bitmap
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.Select(0, 0, 100, 100);

// Select a 100 pixel square that is displayed in the top left corner of the ImageEnView window (100 x 100 pixels of screen area)
ImageEnView1.SelectionBase := iesbClientArea;
ImageEnView1.Select(0, 0, 100, 100);

Note: When ImageEnView1.Zoom = 100, ImageEnView1.ViewX = 0 and ImageEnView1.ViewY = 0, then both the preceeding examples will provide the same result

// Select 20% of the center of the screen
const
  Selection_Size = 0.2; // 20% of screen area
begin
  ImageEnView1.SelectionBase := iesbClientArea;
  ImageEnView1.Select(Trunc((0.5 - Selection_Size / 2) * ImageEnView1.ClientWidth),
                      Trunc((0.5 - Selection_Size / 2) * ImageEnView1.ClientHeight),
                      Trunc((0.5 + Selection_Size / 2) * ImageEnView1.ClientWidth),
                      Trunc((0.5 + Selection_Size / 2) * ImageEnView1.ClientHeight));
end;

// Make circular selection of entire image and crop
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.SelectEllipse(ImageEnView1.IEBitmap.Width div 2,
                           ImageEnView1.IEBitmap.Height div 2,
                           ImageEnView1.IEBitmap.Width,
                           ImageEnView1.IEBitmap.Height);
ImageEnView1.Proc.CropSel();

// Select whole image and allow user to deselect circular regions
With ImageEnView1 do
begin
  SelectionBase := iesbBitmap;
  Select( 0, 0, IEBitmap.Width, IEBitmap.Height );
  ShiftKeyLock := [ iessCtrl_SubFromSel ];
  MouseInteractGeneral := [ miSelectCircle ];
end;


See Also


- Select
- XBmp2Scr
- XScr2Bmp
- YBmp2Scr
- YScr2Bmp