Brain Spew - Neville Mehta's Blog

Thursday, November 09, 2006

PathGeometry and StreamGeometry Mini-Language Syntax

I have been playing around with geometry in WPF lately and came accross the following syntax for drawing a curve:

<!-- clip -->


<Path
Data="M10,100 C 100,0 200,200 300,100 z"
Fill="Blue"
Stroke="Black"
StrokeThickness="4" />



<!-- clip-->

This is confusing because the Data property of the System.Windows.Shapes.Path object takes an object dervied from System.Windows.Media.Geometry.

It turns out that this is a special syntax for defining StreamGeometry objects or Figures in a PathGeometry object.

in the above example the "M" is saying is saying start at the absoloute position of (10, 100) then the "C" is saying draw a cubic bezier curve starting at (100, 0) then go to (200, 200) and ending at (300, 100). The "z" simply says to end the curve here and draw a line from the starting position to the current point.

For a more complete explaination, go to:
Path Marup Syntax

0 Comments:

Post a Comment

<< Home