ImageEn, unit imageenview

TImageEnView.LayersInsert

TImageEnView.LayersInsert


Declaration


// General overloads
procedure LayersInsert(Position: Integer; Kind: TIELayerKind = ielkImage; PosX: Integer = -1; PosY: Integer = -1; Width: Integer = 0; Height: Integer = 0); overload;
procedure LayersInsert(Position: Integer; Kind: TIELayerKind; Rect: TRect); overload;

// Blank image overload (creates TIEImageLayer)
procedure LayersInsert(Position: Integer; Width: Integer; Height: Integer; PixelFormat: TIEPixelFormat = ie24RGB; PosX: Integer = 0; PosY: Integer = 0); overload;

// Assign bitmap overload (creates TIEImageLayer)
procedure LayersInsert(Position: Integer; Bitmap: TIEBitmap); overload;

// Loads image overload (creates TIEImageLayer)
procedure LayersInsert(Position: Integer; FileName: String; PosX: Integer = -1; PosY: Integer = -1); overload;

// Line overload (creates TIELineLayer)
procedure LayersInsert(Position: Integer; StartPoint: TPoint; EndPoint: TPoint); overload;

// Shape overloads (creates TIEShapeLayer)
procedure LayersInsert(Position: Integer; Shape: TIEShape; PosX: Integer = -1; PosY: Integer = -1; Width: Integer = 0; Height: Integer = 0); overload;
procedure LayersInsert(Position: Integer; Shape: TIEShape; Rect: TRect; BorderColor: TColor = clBlack; BorderWidth: Integer = 1; FillColor: TColor = clNone); overload;

// Text overload (creates TIETextLayer)
procedure LayersInsert(Position: Integer; Text: String; FontSize : Integer; FontColor : TColor; FontName : string; FontStyle : TFontStyles = []; PosX: Integer = -1; PosY: Integer = -1); overload;

// Cloning overload
procedure LayersInsert(Position: Integer; Layer: TIELayer; PosX: Integer = -1; PosY: Integer = -1; Width: Integer = 0; Height: Integer = 0); overload;


Description


Inserts a new layer into the layers list at the specified position. The new layer will become the current layer.
If the size and pixel format are not specified then the new layer assumes that of the current layer.
You can specify PosX and PosY for the destination position of the layer. Pass as -1, -1 to use the next available position.

Note: Only a TIEImageLayer can be inserted at position 0 (i.e. as background layer). If you attempt to insert a non-image layer at position 0, it will be inserted at 1


Examples


ImageEnView1.IO.LoadFromFile( 'C:\first.jpg' ); // Load image into first layer (will become background)
ImageEnView1.LayersInsert( 1 ); // Insert a new layer above the background layer
ImageEnView1.IO.LoadFromFile( 'C:\second.jpg' ); // Load image into the new layer (now the current layer)


// Load an image from file and add it as a layer
ImageEnView1.LayersInsert( 1, 'C:\MyImage.jpg' );


// Insert a text layer
ImageEnView1.LayersInsert( 1, 'My text layer', 14, clBlack, 'Arial');


// Insert a yellow explosion shape layer at size 220 x 120
ImageEnView1.LayersInsert( 1, iesExplosion, 50, 50, 220, 120 );
ImageEnView1.CurrentLayer.FillColor := clYellow;
ImageEnView1.CurrentLayer.BorderWidth := 0;
ImageEnView1.Update();




// Insert an image layer and assign a pink border
ImageEnView1.LayersInsert( 3, ielkImage ); // Insert an image layer after layer 2 (i.e. 3rd layer)
ImageEnView1.IO.LoadFromFile('C:\New Zealand.jpg'); // Load image into the new/active layer
ImageEnView1.CurrentLayer.BorderColor := $008000FF;
ImageEnView1.CurrentLayer.BorderWidth := 3;




// Insert a text layer
ImageEnView1.LayersInsert( 1, ielkText );
TIETextLayer( ImageEnView1.CurrentLayer ).Text := 'This is a Text Layer';
TIETextLayer( ImageEnView1.CurrentLayer ).BorderColor := clBlack;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth := 1;
TIETextLayer( ImageEnView1.CurrentLayer ).FillColor := clWhite;
ImageEnView1.Update();




// Clone the current layer
ImageEnView1.LayersInsert( ImageEnView1.CurrentLayer.LayerIndex, ImageEnView1.CurrentLayer );


// Insert a polyline layer (Triangle)
ImageEnView1.LayersInsert( 1, ielkPolyline, Rect(100, 100, 1000, 1000) );
TIEPolylineLayer( ImageEnView1.CurrentLayer ).SetPoints( [ Point(500, 0), Point(1000, 1000), Point(0, 1000) ], True );
TIEPolylineLayer( ImageEnView1.CurrentLayer ).BorderWidth := 3;
TIEPolylineLayer( ImageEnView1.CurrentLayer ).BorderColor := clRed;
TIEPolylineLayer( ImageEnView1.CurrentLayer ).FillColor := clWhite;
ImageEnView1.Update();


// Add an angle layer
ImageEnView1.LayersInsert( 1, ielkAngle );
with TIEAngleLayer( ImageEnView1.CurrentLayer ) do
begin
  LineWidth := 2;
  LineColor := clDkGray;
  LabelFont.Color := clBlue;
  LabelFont.Style := [fsBold];

  // Set by points on bitmap
  SetPoints( [ Point( xx + 130, yy + 0 ), Point( xx + 0, yy + 130 ), Point( xx + 130, yy + 0 ), iepbBitmap );
end;




See Also


-TIELayer
-LayersAdd
-LayersCreateFromSelection
-LayersCreateFromClipboard
-LayersCreateFromFile
-LayersCreatePolylineFromSelection