Skip to content

Latest commit

 

History

History
86 lines (48 loc) · 2.31 KB

File metadata and controls

86 lines (48 loc) · 2.31 KB

Layers

A layer acts like a transparent sheet upon which shapes can be placed, sub-layers (layers within layers to any desired depth are supported. Layers provide a mechanism for overlaying groups of views on top of each other. Layers can also clip their contents to exclude any content outside a user defined area.

Layers can be 2D or 3D, defined by their behaviour property.

When a layer is added to the stage it is assigned a unique depth value. By default the stage has a root layer with a depth value of 0.

Layers are views and inherit the position, orientation and scale of their parent view. Layers are drawn in an order determined by a layer depth value.

Note: Layers work independently of the View hierarchy. Layers can be positioned anywhere in the view tree. The layer draw order is always defined by the depth value.

// C# example of adding a view to the root layer

//  using stage.add() will automatically add view to the root layer
Stage stage = Stage.GetCurrent();
stage.add( myView );

// Or you can explicitly add a view to the root layer.
Layer rootLayer = stage.GetRootLayer();
rootLayer.add( myView );  // adds a view to the root layer

Layer View Specific Properties

  • clippingEnable
  • clippingBox
  • behaviour : which can be "LAYER_UI" (default), or "LAYER_3D"

Layer clipping

Clips the contents of the layer to a rectangle.

Re-ordering layers

A range of functions are provided to change the draw order of the layers.

Rendering order of Views inside of a layer

Layer_UI

Background

  • Graphics are drawn in DALi using renderers
  • Views can have zero or many renderers
  • Renderers can be shared by views
  • Renderers have a depth index property

With LAYER_UI, the draw order of the renderers is defined by both:

  • Renderer depth index.
  • Position of view in the view tree

Layer_3D

Set Layer behaviour to "LAYER_3D";

Opaque renderers are drawn first and writen to the depth buffer.

Transparent renderers are drawn in order of distance from the camera ( painter's algorithm ).

View drawing mode OVERLAY_2D

Inside a layer it is possible to force tree views to be drawn on top of everything else in the layer.