Sunday, August 3, 2008

Silverlight graphics output primitives

In computer graphics literature output primitives are defined as basic and the simplest geometric structures that can be rendered by a graphics engine. A set of output primitives can be grouped to describe more complex structures.

Examples of Silverlight output primitives include Line, Polyline, Polygon, Rectangle and Ellipse. Usages of these objects are illustrated in following examples.

Line

<Line X1="10" Y1="10"
    X2="70" Y2="70"
    Stroke="Red"
    StrokeThickness="5"/>

Polyline

<Polyline
    Points="10,10,70,10,10,70,70,70"
    Stroke="Green" StrokeThickness="1"/>

Polygon

<Polygon Points="40,10, 10,40,
    40,70,70,40,
    40,10"
    Stroke="Red" StrokeThickness="1"
    Fill="Blue"/>

Rectangle

<Rectangle Width="40" Height="60"
    Canvas.Left="20" Canvas.Top="10"
    Stroke="Red" StrokeThickness="1"/>

Ellipse

<Ellipse Width="40" Height="60"
    Canvas.Left="20" Canvas.Top="10"
    Fill="Green"/>

No comments: