ImageEn, unit iesettings

TIEGlobalSettings.DefaultLayerShape

TIEGlobalSettings.DefaultLayerShape


Declaration

property DefaultLayerShape: TIEShape;


Description

Specifies the text that is displayed when creating new text layers in a TImageEnView.

Default: iesEllipse

Note: This can be overridden by LayerDefaults


Examples

// Make star the default shape for new new shape layers
IEGlobalSettings().DefaultLayerShape := iesStar5;


// Enable our star stamping mode, which adds a star directly to the image wherever the user clicks
procedure Tfmain.btnAddStampClick(Sender: TObject);
const
  Stamp_Border_Color = clRed;
  Stamp_Border_Width = 2;
  Stamp_Fill_Color   = clYellow;
  Stamp_Shape        = iesStar5;
  Stamp_Width        = 50;
  Stamp_Height       = 50;
var
  cursorBMP: TIEBitmap;
begin
  // Set default style of our layer
  // Note: Can also use OnNewLayer event to customize further
  ImageEnView1.LayerDefaults.Clear();
  ImageEnView1.LayerDefaults.Values[ IELP_BorderColor ] := ColorToString( Stamp_Border_Color );
  ImageEnView1.LayerDefaults.Values[ IELP_BorderWidth ] := IntToStr( Stamp_Border_Width );
  ImageEnView1.LayerDefaults.Values[ IELP_FillColor ] := ColorToString( Stamp_Fill_Color );
  // Easier to use DefaultLayerShape... ImageEnView1.LayerDefaults.Values[ IELP_Shape  ]    := IntToStr( Ord( Stamp_Shape ));
  ImageEnView1.LayerDefaults.Values[ IELP_Width ]     := IntToStr( Stamp_Width );
  ImageEnView1.LayerDefaults.Values[ IELP_Height ]    := IntToStr( Stamp_Height );

  // Enable stamp mode, and automatic merging of layers
  ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [ loStampMode, loAutoMergeNewLayers ];
  IEGlobalSettings().DefaultLayerShape := Stamp_Shape;
  ImageEnView1.MouseInteractLayers := [ mlCreateShapeLayers ];

  // Show a matching star shaped cursor
  cursorBMP := TIEBitmap.Create( Stamp_Width, Stamp_Height );
  try
    cursorBMP.FillWithShape( Stamp_Shape, Stamp_Width, Stamp_Height, Stamp_Border_Color, Stamp_Border_Width, Stamp_Fill_Color, True, False );
    ImageEnView1.SetZoneCursorBitmap( cursorBMP );
  finally
    cursorBMP.Free;
  end;
end;