ImageEn, unit iexLayers

TIELayer.Rotate

TIELayer.Rotate


Declaration

property Rotate: Double;


Description

Specifies the layer rotation angle in degrees counter-clockwise.
Rotation and Resize cannot be used at the same time.

To allow resize after a layer rotation, it must be enacted, i.e. actually rotate the bitmap.
Conversely to allow rotation after a resize, the resizing must be enacted, actually resizing the bitmap.
To enact layer rotation, call LayersFixRotations.
To enact layer resizing, call LayersFixSizes.
Finally, multiple rotations can cause the bitmap to add an external, transparent border. To remove this border call LayersFixBorders.



Notes:
- When rotation is handled by MouseInteractLayers (setting mlRotateLayers), you don't need to call LayersFixRotations, LayersFixSizes and LayersFixBorders.
- For Text layers, Rotate specifies the rotation of the text only. To rotate the border shape, set BorderRotate
- For angle layers, Rotate updates the start and end angles, which can lead to inaccuracy if frequently set, so you are better to directly use StartAngle, EndAngle or SweepAngle


Demos

Demo Description Demo Project Folder Compiled Demo
Layer Rotation Free rotation and resizing of layers using mouse interactions \Demos\LayerEditing\RotateLayers\RotateLayers.dpr   
All Layer Editing Usage of image, shape, text and line layers \Demos\LayerEditing\Layers_AllTypes\Layers.dpr   
Image Layer Editing Usage of image layers \Demos\LayerEditing\Layers_Images\Layers.dpr   
Adding Text to Images Draw text onto images using text layers \Demos\LayerEditing\Layers_TextOut\TextLayers.dpr   


Examples

// Rotate a line
ImageEnView1.CurrentLayer.Rotate := 235;
ImageEnView1.Update();



// Set rotation of all selected layers
ImageEnView1.LockUpdate;
for i := 0 to ImageEnView1.LayersCount - 1 do
  if ImageEnView1.Layers[i].Selected then
    ImageEnView1.Layers[i].Rotate := 90;
ImageEnView1.LayersFixRotations( LYR_SELECTED_LAYERS );
ImageEnView1.UnlockUpdate;

// Apply a "Paid" stamp to image
with ImageEnView1 do
begin
  LayersAdd( 'PAID', 42, clRed, 'Arial Black', [fsBold] );
  CurrentLayer.Rotate := 30;
  TIETextLayer( CurrentLayer ).SizeToText();
  CurrentLayer.PosX := IELayer_Pos_HCenter;
  CurrentLayer.PosY := IELayer_Pos_VCenter;
  LayersMergeAll();
end;


See Also

- LayersRotateAll
- LayersTextRotateMode
- SupportsFeature
- RotateCenterX
- RotateCenterY
- Flip