ImageEn, unit imageenview

TImageEnView.OnDrawLayer

TImageEnView.OnDrawLayer


Declaration

property OnDrawLayer: TIEDrawLayerEvent;


Description

Occurs immediately after a layer is painted.

Parameter Description
Dest The destination bitmap (usually the back buffer)
LayerIndex The layer index that we are drawing

Notes:
- Use Layers[].ClientAreaBox rectangle to know actual rectangle coordinates
- With TImageEnView.OnDrawLayer, Dest is the entire image the layer has been painted to. With OnBeforeDrawLayer, Dest is only the layer as an image


Demos

Demo  Demos\LayerEditing\Layers_CustomDraw\LayersDraw.dpr


Example

// Display the index over the layer
procedure Tfmain.ImageEnView1DrawLayer(Sender: TObject; dest: TIEBitmap; LayerIndex: Integer);
var
  lyrRect, aRect: TRect;
begin
  lyrRect := ImageEnView1.Layers[ LayerIndex ].ClientAreaBox;
  aRect := Rect( lyrRect.Left + 10, lyrRect.Top + 10, lyrRect.Left + 40, lyrRect.Top + 40 );
  With dest.Canvas do
  begin
    // Simple example: Would be better to center text in filled rect
    Brush.Color := clBlue;
    FillRect( aRect );

    Font.Color := clWhite;
    Font.Height := 12;
    Font.Style := [fsBold];

    TextRect( aRect, lyrRect.Left + 20, lyrRect.Top + 20, IntToStr( LayerIndex ));
  end;
end;