Context Free Art – Tutorial 7

cool minecraft skins to download

We continue the study of path command. Take a look of the closed shape, a square.

startshape MyShape

path Line {
	MOVETO {x -0.5 y -0.5}
	LINETO {x 0.5 y -0.5}
	LINETO {x 0.5 y 0.5}
	LINETO {x -0.5 y 0.5}
	LINETO {x -0.5 y -0.5}
	CLOSEPOLY {}
	STROKE {}
}

rule MyShape {
	Line {}
}
CLOSEPOLY

If by any chances, you type the wrong position for the last end point or there is rounding error after a sequence of calculation, you may end of with:

startshape MyShape

path Line {
	MOVETO {x -0.5 y -0.5}
	LINETO {x 0.5 y -0.5}
	LINETO {x 0.5 y 0.5}
	LINETO {x -0.5 y 0.5}
	LINETO {x -0.45 y -0.45}
	CLOSEPOLY {}
	STROKE {}
}

rule MyShape {
	Line {}
}
CLOSEPOLY error

Note the CLOSEPOLY command will connect an extra line segment to close the shape if there is a gap between the beginning and the end points iso win 10en. In case we want to get rid of the error, we can use the CLOSEPOLY command with an extra parameter align.

startshape MyShape

path Line {
	MOVETO {x -0.5 y -0.5}
	LINETO {x 0.5 y -0.5}
	LINETO {x 0.5 y 0.5}
	LINETO {x -0.5 y 0.5}
	LINETO {x -0.45 y -0.45}
	CLOSEPOLY {p align}
	STROKE {}
}

rule MyShape {
	Line {}
}
mw3 kostenlos downloaden vollversion pc