ImageEn, unit imageenview




procedure Select(x1, y1, x2, y2: integer; Op: TIESelOp = iespReplace); virtual;


Selects a portion of the image.
The selected area will be outlined with an animated rectangle.
If SelectionBase is iesbClientArea (default) all coordinates depend on actual zoom and scrolling.
If SelectionBase is iesbBitmap, all coordinates refer to bitmap pixels.

Parameter Description
x1 Top-left horizontal position
y1 Top-left vertical position
x2 Bottom-right horizontal position. Last column not selected
y2 Bottom-right vertical position. Last row not selected
Op Selection operation (add or replace selection). If Op is iespReplace, Select replaces all previous selections. If Op is iespAdd, Select adds a new selection

x2, y2 represent the right/bottom margin (not selected). To select an area of 1x1 pixels we need to select using 0,0,1,1 (the column 1 and the row 1 aren't selected).


// Increase contrast of bitmap rectangle (0,0,49,49)
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.Select(0, 0, 50, 50);

// Enlarge the selection by ten pixels on all sides
With ImageEnView1 do
  SelectionBase := iesbBitmap;
  Select( SelX1 - 10, SelY1 - 10, SelX2 - 10, SelY2 - 10 );

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

// Subtract a circular area from a rectangular selection
ImageEnView1.Select( 42, 133, 326, 214, iespReplace );
ImageEnView1.SelectEllipse( 145, 130, 155, 170, iespSubtract );

See Also

- SelectEllipse
- SelectMagicWand
- SelectChromaKey
- SelectRoundRect
- InvertSelection
- Deselect
- SelX1
- SelY1
- SelX2
- SelY2