ImageEn, unit imageenview

TImageEnView.LayersCount

TImageEnView.LayersCount


Declaration

property LayersCount: Integer;


Description

LayersCount returns the number of layers.
  

Examples

// Clear the top-most layer
ImageEnView1.LayersCurrent := ImageEnView1.LayersCount - 1;
ImageEnView1.Clear;

// Show each of the layers as a thumbnail in a TImageEnMView
// NOTE: This is the same as calling TImageEnMView.AssignLayers
procedure Tfmain.RefreshLayerViewer;
var
  i, idx: integer;
begin
  ImageEnMView1.Clear;
  for i := 0 to ImageEnView1.LayersCount - 1 do
  begin
    idx := ImageEnMView1.AppendImage;
    ImageEnMView1.SetImage( idx, ImageEnView1.Layers[ i ].Bitmap );
    ImageEnMView1.ImageTopText[ i ] := 'Layer ' + inttostr( i );
  end;

  // Highlight current layer
  ImageEnMView1.SelectedImage := ImageEnView1.LayersCurrent;
end;

// Set rotation of all selected layers
ImageEnView1.LockUpdate;
for i := 0 to ImageEnView1.LayersCount - 1 do
  if ImageEnView1.Layers[i].Selected then
    ImageEnView1.Layers[i].Rotate := 90;
ImageEnView1.LayersFixRotations( LYR_SELECTED_LAYERS );
ImageEnView1.UnlockUpdate;

// Flip the image of all image layers
ImageEnView1.LockUpdate();
for I := 0 to ImageEnView1.LayersCount - 1 do
  if ImageEnView1.Layers[ I ] is TIEImageLayer then
    ImageEnView1.Layers[ I ].Bitmap.Flip( fdHorizontal );
ImageEnView1.UnlockUpdate();

// Remove any image layers (except background)
ImageEnView1.LockUpdate;
for I := ImageEnView1.LayersCount - 1 downto 1 do
  if ImageEnView1.Layers[ I ] is TIEImageLayer then
    ImageEnView1.LayersRemove( I );
ImageEnView1.UnlockUpdate();