Properties · Methods · Demos · Examples
Declaration
TIETextLayer = class(TIELayer);
Description
TImageEnView supports multiple layers, allowing the creation of a single image from multiple source images (which can be resized, rotated, moved, etc).
TIETextLayer is a descendent of
TIELayer that displays text. Rich text is supported if
EnableFormatting is true.
You can text image layers with code using
LayersAdd or by user action by setting
MouseInteractLayers to
mlCreateTextLayers.
Review the
Layer Documentation for a full description of layer support.
Demo | Description | Demo Project Folder | Compiled Demo |
Text Layers | Adding and editing text layers, including rich formatting | LayerEditing\Layers_Text\TextLayers.dpr | |
Adding Text to Images | Draw text onto images using text layers | LayerEditing\Layers_TextOut\TextLayers.dpr | |
All Layer Editing | Usage of image, shape, text, polygon and line layers | LayerEditing\Layers_AllTypes\Layers.dpr | |
Stamp Layers | Add text, shapes, images and arrows directly to an image by clicking and dragging | LayerEditing\StampTextAndShapes\StampLayers.dpr | |
// Append a text layer
ImageEnView1.LayersAdd( 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;
TIETextLayer( ImageEnView1.CurrentLayer ).SizeToText();
ImageEnView1.Update();
// 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;
// Allow users to create and edit text layers
IEGlobalSettings().DefaultLayerText := 'Double-click to edit text';
ImageEnView1.MouseInteractLayers := [ mlCreateTextLayers, mlMoveLayers, mlResizeLayers ];
// Add a "Shape" layer with margins around text
ImageEnView1.LayersAdd( ielkText );
TIETextLayer( ImageEnView1.CurrentLayer ).Text := 'EXPLOSION!';
TIETextLayer( ImageEnView1.CurrentLayer ).Font.Style := [fsBold];
TIETextLayer( ImageEnView1.CurrentLayer ).BorderShape := iesExplosion;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderColor := clBlack;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth := 1;
TIETextLayer( ImageEnView1.CurrentLayer ).FillColor := clRed;
TIETextLayer( ImageEnView1.CurrentLayer ).FillColor2 := clYellow;
TIETextLayer( ImageEnView1.CurrentLayer ).FillGradient := gpgVertCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).Alignment := iejCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).Layout := ielCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).HorzMargin := 0.15;
TIETextLayer( ImageEnView1.CurrentLayer ).VertMargin := 0.25;
TIETextLayer( ImageEnView1.CurrentLayer ).SizeToText();
ImageEnView1.Update();
// Add a "Shape" layer with vertically offset text
ImageEnView1.LayersAdd( ielkText, 200, 200, 230, 200 );
ImageEnView1.CurrentLayer.AspectRatioLocked := True;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderShape := iesHeart;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth := 0;
TIETextLayer( ImageEnView1.CurrentLayer ).Font.Style := [fsBold];
TIETextLayer( ImageEnView1.CurrentLayer ).Alignment := iejCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).Layout := ielCenter;
TIETextLayer( ImageEnView1.CurrentLayer ).WordWrap := False;
TIETextLayer( ImageEnView1.CurrentLayer ).Text := 'I Heart Delphi';
TIETextLayer( ImageEnView1.CurrentLayer ).Font.Size := 22;
TIETextLayer( ImageEnView1.CurrentLayer ).TextOverflow := ieoShrink;
TIETextLayer( ImageEnView1.CurrentLayer ).TextOffsetY := -0.15;
ImageEnView1.CurrentLayer.BorderColor := clBlack;
ImageEnView1.CurrentLayer.FillColor := $004646FF;
ImageEnView1.Update();
// Transparent text with rounded yellow border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clWhite;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clYellow;
txtLayer.TextStyling.BorderLineJoin := ieljRound;
txtLayer.TextStyling.FillTransparency1 := 0; // 100% transparent
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();
// Gradient text with border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clRed;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clBlack;
txtLayer.TextStyling.FillColor2 := clYellow;
txtLayer.TextStyling.FillGradient := gpgVertical;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();
GeneralText EditingStyleSize and PositionMeasurement Unique to TIETextLayerSee Also
◼Layer Editing Overview◼LayersAdd◼LayersInsert◼MouseInteractLayers◼AdvancedDrawText