ImageEn, unit iexLayers

TIETextLayer

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.

Demos


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   

Examples


// 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();



Methods and Properties


General
Public Property  AsSVG
Public Method  Assign
Public Method  ConvertToImageLayer
Public Method  CopyToBitmap
Public Property  DrawingInfo
Public Property  DrawOuter
Public Method  DrawToCanvas
Public Method  GetProperties
Public Property  Guid
Public Property  GroupIndex
Public Property  Hint
Public Property  IsMask
Public Property  Kind
Public Property  LayerIndex
Public Property  Locked
Public Property  MaskInverted
Public Property  Modified
Public Property  ModifiedDate
Public Property  Name
Public Property  Selectable
Public Property  Selected
Public Method  SetProperties
Public Method  SetTextProperties
Public Method  SupportsFeature
Public Property  Tag
Public Property  URL
Public Property  UserData
Public Property  UserDataLen
Public Property  Visible
Public Property  VisibleBox

Text Editing
Public Method  ActivateEditor
Public Property  Alignment
Public Property  EnableFormatting
Public Property  Font
Public Property  Layout
Public Method  LoadTextFromFile
Public Property  ReadOnly
Public Property  RichText
Public Property  Text
Public Property  TextOverflow
Public Property  WordWrap

Style
Public Property  AntiAlias
Public Property  AlphaEdgeFeathering
Public Property  BorderColor
Public Property  BorderWidth
Public Property  BorderRotate
Public Property  BorderShape
Public Property  Cropped
Public Property  FillColor
Public Property  FillColor2
Public Property  FillGradient
Public Property  FillOpacity
Public Property  Flip
Public Property  InnerGlow
Public Property  Opacity
Public Property  Operation
Public Property  Rotate
Public Property  ScaleLocking
Public Property  SoftShadow
Public Property  TextStyling

Size and Position
Public Property  AspectRatioLocked
Public Property  AutoSize
Public Property  ClientAreaBox
Public Method  ConvXBmp2Scr
Public Method  ConvXScr2Bmp
Public Method  ConvYBmp2Scr
Public Method  ConvYScr2Bmp
Public Property  Height
Public Method  HorzMargin
Public Method  MaxWidth
Public Property  PosX
Public Property  PosY
Public Method  PreferredAspectRatio
Public Method  RestoreAspectRatio
Public Method  SizeToText
Public Method  TextOffsetX
Public Method  TextOffsetY
Public Method  VertMargin
Public Property  Width

Measurement
Public Property  RulerMode
Public Property  RulerUnits
Public Method  RulerValue
 Unique to TIETextLayer


See Also

Layer Editing Overview
LayersAdd
LayersInsert
MouseInteractLayers
AdvancedDrawText