ImageEn, unit iemview

TImageEnMView.AssignLayers

TImageEnMView.AssignLayers


Declaration

procedure TImageEnMView.AssignLayers(Source: TImageEnView; HighlightSel: Boolean; DoClear: Boolean = True; TextPos: TIEMTextPos = iemtpTop; Reversed: Boolean = False);


Description

Fill content with the layers of a TImageEnView.
If HighlightSel is true, the selected layers will be also be shown as selected in this TImageEnMView.
Set DoClear to true if you don't wish to clear the existing content.
The name of the layer will be output in the position of TextPos (or use TIEMTextPos(-1) for no text).
By default, layers are output in back-most to front-most order (so the index of the image aligns with the index of the layer). Set Reverse to True to have front-most layers first.



Note: For more a complete layer display, use TImageEnLayerMView


Example

// Show layer content of a TImageEnView in a TImageEnMView. Allow selection of layers via the TImageEnMView
// For more info, see the demo: \Demos\LayerEditing\Layers_Images\Layers.dpr

// OnImageSelect event of your TImageEnMView
procedure Tfmain.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  ImageEnView1.LayersCurrent := idx;
end;

// OnImageDeselect event of your TImageEnMView
procedure Tfmain.ImageEnMView1ImageDeselect(Sender: TObject; idx: Integer);
begin
  ImageEnView1.Layers[ idx ].Selected := False;
end;

// OnLayerNotifyEx event of your TImageEnView
procedure Tfmain.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
  // Events that change the layers list, or the way layers look
  if event in [ ielSelected, ielDeselected, ielMoved, ielResized, ielRotated, ielCreated, ielMerged, ielGrouped, ielAction, ielEdited, ielEditedPoints, ielRemoved, ielArranged ] then
    RefreshLayerViewer();
end;

// Called by any of your controls that change the look of your layers
procedure Tfmain.LayerControlChange(Sender: TObject);
begin
  RefreshLayerViewer();
end;

// A private method that calls AssignLayers
procedure Tfmain.RefreshLayerViewer();
begin
  ImageEnMView1.AssignLayers( ImageEnView1, True );
end;


Compatibility Information

Prior to v8.0.0, AssignLayers was outputting in an order different from documentation. The default value for the Reversed parameter has been changed. Check any calls to AssignLayers in your code.


See Also

Layers
OnLayerNotifyEx