DISPLAY & LAYERS

Manipulating several layers on each of the three screens

Earlier we described the three Alambik screens: MID, BACK and FRONT.

When displaying and moving a graphic object, you should always ask yourself whether this object should go above or underneath the other graphics objects it may cross.

Objects in the MID screen are always displayed above objects in the BACK screen. In the same way, objects in the FRONT screen are always displayed above objects in the two other screens.

In each screen, every 2D graphic object is assigned a layer. A single layer can be assigned to several objects at the same time. An object with a higher-numbered layer will always be displayed above an object with a lower-numbered layer. Each screen can contain up to 65,535 layers.

To make sure that the mouse cursor is displayed above all other objects, its default layer is set to 65,535. By convention, the default layer of any other graphic object is set to 255 (DEFAULT_LAYER).

When scripting, you'll want to decide whether it's best to use all three screens (for example, if you're doing video post production and you want the video signal to be displayed in BACK, graphic elements to be added in MID, and FRONT to be used for the foreground), or whether to simply use one or two screens in order to optimise the refreshment calculation.

Persistence:

In order to keep the computer's CPU use to a minimum, Alambik refreshes only persistent 2D graphic objects. A layer can be allocated to a 2D graphic object only if that object is set as persistent.

The persistence of any 2D graphic object can be set to ON or OFF using the instruction 2DObject.persistence.set.

By default, the persistence of the following graphic objects is set to ON:

· Viewport
· Sprite
· Video
· Mouse
· Button
· Menulist
· Scroll
· Water

On the contrary, the default persistence of these 2D graphic objects is set to OFF:

· Picture
· Icon
· Panel
· Gradient
· Text

NOTE:

2D graphic primitives (pixel, line, box, circle, arc) cannot be given ObjectIDs. Thus, they can neither be sequenced nor allocated layers.

If you want to allocate a layer to one or several 2D graphic primitives, you should display them in a virtual screen using the instruction screen.set.

Masking the display:

By default, Alambik Script uses progressive display mode. In this mode, graphic elements are displayed as soon as they possibly can be (i.e. once they have been sent through the network, then rendered if need be …).

When in progressive display mode, calculations as well as math routines are slowed. One way to speed up a script is to suspend progressive display mode until every element is ready, and only then to display the complete screen.

To suspend progressive display in all Alambik screens (MID+BACK+FRONT), use the instruction screen.mask (ON). Graphic elements can then be displayed all at the same time using the instruction screen.display.

Screen.mask (OFF) displays suspended graphic elements (if any), and reverts to the default progressive display mode.

To toggle the visibility state of a persistent graphic object (2D or 3D), use the object.hide instructions.