ImageEn, unit imageenview

TImageEnView.LayersRepositionAll

TImageEnView.LayersRepositionAll


Declaration

procedure LayersRepositionAll(MoveX, MoveY: Integer; SelectedOnly: Boolean = False; Sizing: Boolean = False; MaintainRelativePos: Boolean = False);


Description

Updates PosX and PosY of all layers (or just selected if SelectedOnly = True) to move them to a new position. If Sizing is true then Layer is resized (top-left position does not move).

These consts are also for MoveX:
Const Description
IELayer_Pos_Left Adjust PosX so layer is aligned to the left of the background layer
IELayer_Pos_HCenter Adjust PosX so layer is aligned to the horizontal center of the background layer
IELayer_Pos_Right Adjust PosX so layer is aligned to the right of the background layer

These consts are also MoveY:
Const Description
IELayer_Pos_Top Adjust PosY so layer is aligned to the top of the background layer
IELayer_Pos_VCenter Adjust PosY so layer is aligned to the vertical center of the background layer
IELayer_Pos_Bottom Adjust PosY so layer is aligned to the bottom of the background layer

When using consts, MaintainRelativePos determines whether layers are moved relative to each other, when false (default), the relative position of layers will change (e.g. layers that were not overlapping before, may overlap after). Setting to true will maintain their relative positions.

Notes:
- Do not use the IELayer_Pos_* consts when sizing
- Use LayersSizeAll to resize layers by percentage


Examples

// Move all layers 50 pixels up and left
ImageEnView1.LayersRepositionAll( -50, -50 );

// Move selected layers 100 pixels down
ImageEnView1.LayersRepositionAll( 0, 100, true );

// Enlarge all layers vertically and horizontally by 10 pixels
ImageEnView.LayersRepositionAll( 10, 10, False, True );

// Center all layers in the middle of the image
ImageEnView1.LayersRepositionAll( IELayer_Pos_HCenter, IELayer_Pos_VCenter );

// Center all layers in the middle of the image, but maintain the position of the layers relative to each other (i.e. prevent layer overlapping)
ImageEnView1.LayersRepositionAll( IELayer_Pos_HCenter, IELayer_Pos_VCenter, False, False, True );


// Zoom so layers fill entire view area

// Make IEView consider all layers when calculating image bounds
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];

// Position layers so origin is 0,0
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);

// Adjust zoom so all layers fill the view area
ImageEnView1.Fit();


See Also

- LayersRotateAll
- LayersSizeAll
- LayersAlign