ImageEn, unit iexLayers

TIELayer.ConvertToImageLayer

TIELayer.ConvertToImageLayer


Declaration

procedure ConvertToImageLayer(QualityFactor: Double = 2; CropAlpha: Boolean = True);


Description

Changes the type of the current layer to TIEImageLayer.
This will change it from a vector-based layer to a standard bitmap layer. Bitmap layers can be edited using standard image modification features, but the quality will be lost if you resize the layer.
If the layer type is already TIEImageLayer then rotation is fixed using LayersFixRotations and opacity is applied to the image (i.e. converted to image alpha).
QualityFactor determines the size that the layer bitmap is created. A QualityFactor of 1 will create the bitmap at the current display size, whereas a QualityFactor of 2 would create it at double the display size (allowing it to be zoomed up 200% without loss of quality).
If CropAlpha is true, then it remove any alpha from the edges of the layer.

Note:
For text layers, a QualityFactor of 1 usually works best
To convert multiple layers, use LayersConvertToImageLayers


Examples

// Convert the current layer to an image, and apply a Negative effect
ImageEnView1.CurrentLayer.ConvertToImageLayer();
ImageEnView1.Proc.Negative();

// Convert an image layer with 50% opacity to an image with 50% alpha
ImageEnView1.LayersAdd( ielkImage );
TIEImageLayer( ImageEnView1.CurrentLayer ).Bitmap.LoadFromFile( 'D:\MyImage.jpeg' );
ImageEnView1.CurrentLayer.Opacity := 0.50;
ImageEnView1.CurrentLayer.ConvertToImageLayer();

// Convert all rich text layers to images
for i := 0 to ImageEnView1.LayersCount - 1 do
  if ( ImageEnView1.Layers[i] is TIETextLayer ) and
     ( TIETextLayer( ImageEnView1.Layers[i]).IsFormatted() ) then
    ImageEnView1.Layers[i].ConvertToImageLayer(1, True);