ImageEn, unit iexUserInteractions

TIECropToolOptions


Declaration

TIECropToolOptions = set of (iecoAllowResizing, iecoAllowRotating, iecoAllowMoving, iecoSideGripsRespectLocks, iecoSizeLocksAreMinimums, iecoLimitToBounds, iecoAllowPerspectiveWraps, iecoRotationGrip);


Description

Value Description
iecoAllowResizing The user can resize the crop selection by dragging the corner or side grips
iecoAllowRotating The user can rotate the crop selection by dragging outside the corner grips (Also see iecoRotationGrip)
iecoAllowMoving The user can move the crop selection by clicking within the selection area
iecoSideGripsRespectLocks Determines whether the specified aspect ratio lock is enforced when dragging the side, top and bottom grips. If this option is not set then only the corner grips will respect the lock
iecoSizeLocksAreMinimums If included, the specified LockWidth or LockHeight are treated as minimum values, i.e. the user can make the selection larger than the specified values, but not smaller
iecoLimitToBounds If included, the crop selection cannot be moved outside of the image area
iecoAllowPerspectiveWraps If included and Mode is iectmPERSPECTIVE, the selection starting point affects the perspective transformation (i.e. starting point will become the top-left of the cropped image). For example, a selection that starts at the bottom-right of an image will be rotated 180 deg.
iecoRotationGrip If iecoAllowRotating is included to allow rotation of the selection, then iecoRotationGrip determines whether a grip is shown below the selection allowing the user to click and rotate the selection. If iecoRotationGrip is not included, the user can click and drag anywhere outside the selection to rotate

Default: [iecoAllowResizing, iecoAllowRotating, iecoAllowMoving]

Note:
 iecoLimitToBounds has no effect if iectmPERSPECTIVE or LockAspectRatio are used
 You should Invalidate after setting Options to update the view if a selection is active


Examples

// Do not allow the user to resize the crop tool selection (i.e. only rotation and creation would be allowed)
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options - [ iecoAllowResizing ];
ImageEnView1.Invalidate();

// Do not allow the user to rotate the crop tool selection (i.e. only resizing and creation would be allowed)
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options - [ iecoAllowRotating ];
ImageEnView1.Invalidate();

// Show a rotation grip below the selection to make it easier to rotate
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options + [ iecoRotationGrip ];
ImageEnView1.Invalidate();

// Do not allow the user to resize or rotate the crop tool selection (i.e. only creation would be allowed)
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options - [ iecoAllowResizing, iecoAllowRotating ];
ImageEnView1.Invalidate();

// We want a fixed aspect ratio of 4:3, which is enforced even if the user drags the side grips
ImageEnView1.CropTool.LockAspectRatio := 4 / 3;
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options + [iecoSideGripsRespectLocks];

// Do not allow a selection smaller than 100x100 pixels
ImageEnView1.CropTool.Options := [iecoSizeLocksAreMinimums];
ImageEnView1.CropTool.LockWidth  := 100;
ImageEnView1.CropTool.LockHeight := 100;

// Prevent the user moving the crop selection outside the image area
ImageEnView1.CropTool.Options := ImageEnView1.CropTool.Options + [iecoLimitToBounds];

// Enable persective cropping, and allow selection starting point to become the top-left of the new image
ImageEnView1.CropTool.Mode    := iectmPERSPECTIVE;
ImageEnView1.CropTool.Options := [iecoAllowPerspectiveWraps];