TGML Document Structure

A TGML Graphics document always consists of at least one element, the root ("outermost") TGML element. This TGML element is the ancestor of all other elements in the document.

Layer and Group are examples of grouping (container) elements that are used to structure the graphics. Elements that describe shapes and other graphical (visible) objects can also have children, but these children are not visible objects, but elements that add a specific behavior, such as gradients, animations and dynamic bindings. The example below shows TGML code with the TGML root element and a number of child elements:

Copy
<TGML Width="400" Height="250" Stretch="Uniform" >
    <Layer Name="Background">
        <Rectangle Left="0.0" Top="0.0" Width="400.0" Height="250.0" Fill="None" Stroke-"None">
            <LinearGradient Attribute="Fill " EndPoint="0.0,1.0" SpreadMethod="Pad" StartPoint="0.0,0.0">
                <GradientStop Color="#FFFFFF" Offset="0.0"/>
                <GradientStop Color="#803080" Offset="l.0"/>
            </LinearGradient>
        </Rectangle>
    </Layer>
    <Layer Name="Foreground">
        <Group>
            <Line Xl="75.0" Yl="50.0" X2="325.0" Y2="75.0" Stroke="#FF0000" StrokeWidth="2.0"/>
            <Polyline Points="50.0,100.0 150.0,75.0 175.0,125.0 150.0,200.0 75.0,125.0" Stroke="#0000FF"/>
            <Polygon Points="200.0,125.0 350.0,100.0 325.0,150.0 350.0,200.0 250.0,175.0" Stroke="#00FF00" Fill="#FFFF00" /> 
        </Group>
    </Layer>
</TGML>

The graphic as seen in Graphics Editor: