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


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;


Demos


  Demos\LayerEditing\Layers_Images\Layers.dpr
  Demos\LayerEditing\Layers_AllTypes\Layers.dpr
  Demos\LayerEditing\RotateLayers\RotateLayers.dpr
  Demos\LayerEditing\Layers_TextOut\TextLayers.dpr



See Also


- LayersRotateAll
- LayersTextRotateMode
- SupportsFeature