5. Shapes

5.1 Basics

X2D documents contain the following set of predefined shape objects:

<rectangle>
<circle>
<line>
<ellipse>
<polyline>
<polygon>

X2D documents contain the following set of predefined shape objects: These shape elements have all of the basic component attributes such as position and size. They also have outline and fill attributes to indicate the color of the outline and fill of the shape. By default, these colors are (0.0, 0.0, 0.0, 0.0). That is, black and completely transparent. Note that the color attribute does not apply to shape components as they are replaced by fill and outline.

5.2 Examples

The following will draw a white rectangle at position (100, 100) and with dimensions 400x400:

<x2d>
  <rectangle position="100 100" size="400 400" fill="1 1 1 1"/>
</x2d>

The following will draw a blue circle with a red outline at (50, 50).

<x2d>
  <circle cx="50" cy="50" r="100" fill="blue" outline="red"/>
</x2d>

Here is a polyline and a polygon:

<x2d>
  <polyline verts="0 0 20 20 50 30 60 50" color="1 0 0 1"/>
  <polygon verts="0 0 20 20 40 0" outline="0 1 0 1"/>
</x2d>

Here is a line:

<x2d>
  <line verts="0 0 20 20" color="1 0 0 1"/>
</x2d>