A layer is a subtype of group item that is made for compositions. By default XML description of layer item looks like:
<cg-item group-type='layer' id='layer-000'> <layer/> <cg-props pos-x='0' pos-y='0' width='1920' height='1080' show='yes' move-type='accel-both' alpha='255' bg-color='Black(0)' pixel-ar='0.' play-mode='loop' interlace='auto' scale='fit-ar' align='top-left' pause='no' edges-smooth='0'> <indent left='0' right='0' top='0' bottom='0' use-for-bg='no'/> <group-indent left='0' right='0' top='0' bottom='0'/> </cg-props> </cg-item>
To add a new layer with a code you should call:
string myLayerID = "myLayer"; string layerXML = "<layer/>"; double relativeX = 0.05; double relativeY = 0.05; int isRelative = 1; int isShow = 1;
myCharGen.AddNewItem(layerXML, relativeX, relativeY, isRelative, isShow, ref myLayerID);
There are no specific parameters for layer except the base ones. So you can manipulate with layer size, position, movement etc.
You can display your compositions in separate layers with the CompositionsDisplayInLayer method. This method contains the following parameters:
- _bsCompositionName - composition name to be displayed
- _bsParamString - additional parameters (reserved for future use) - at the moment this parameter is ignored
- _bsLayerID - target layer ID where composition will be displayed
- _dblTimeIntro - time to introduce a composition - to show composition immediately set 0. Value is in seconds.
- _dblShowTime - time to show composition - if you want to keep a composition on screen without time limits set 0. Value is in seconds.
- _dblTimeExit - time to hide a composition - to hide it immediately set 0. Value is in seconds.
A simple example for CompositionsDisplayInLayer looks like:
string myCompositionID = "composition-000"; string myParameters = ""; string targetLayer = "layer-000"; double inTime = 0.5; double showTime = 5.0; double hideTime = 1.5; myCharGen.CompositionsDisplayInLayer(myCompositionID, myParameters, targetLayer, inTime, showTime, hideTime);
With layers, you can easily set Z-order for your compositions - just set the layer item Z-order with the ChangeItemZOrder method:
myCharGen.ChangeItemZOrder(myLayerID, 10);