ImageEn, unit imageenview




function LayersRect(SelOnly: Boolean = False; ExcludeLayer0: Boolean = False): TIERectangle;


Returns the coverage area of all or selected layers.
The result will include any layers outside the background layer (if LayersCropped and Cropped are not set).
If ExcludeLayer0 is True, then the background layer is not included in the result.

- If layers extend to the left or above the background layer, then Result.X/Y will be less than PosX/Y of Layer 0
- If layers extend to the right or below the background layer, then Result.Width/Height may be greater than the dimensions of IEBitmap


// Center layers around point, pt

// Get position of all layers
layersRect := ImageEnView1.LayersRect( False, True );

// Find center point of layers
hCtr := layersRect.x + layersRect.Width div 2;
vCtr := layersRect.y + layersRect.Height div 2;

// Move layers to new center point
ImageEnView1.LayersRepositionAll( -hCtr + pt.X, -vCtr + pt.Y );

See Also

- MaxLayerWidth
- MaxLayerHeight