-
Notifications
You must be signed in to change notification settings - Fork 33
Startshape Directive
CFDG files are mostly just a collection of shape rules for generating shapes, but Context Free/CFDG needs to know which shape to start with. The startshape directive does this. A startshape directive is simply a line in the CFDG file that begins with the word startshape followed by the name of the shape to start with. If the shape has parameters then they must also be specified.
Context Free/CFDG begins the rendering process by picking one of the rules for that named shape and executing it with the following characteristics:
- Position is (0, 0)
- Size is (1, 1) in (x, y)
- Z-axis position is 0 and z-axis scale is 1
- Rotation is 0 degrees.
- Skew is (0 degrees, 0 degrees)
- No reflection
- Color is opaque black (hue = 0, saturation = 0, brightness = 0, alpha = 1)
For example:
startshape JustACirclePlease
shape JustACirclePlease {
CIRCLE []
}
An optional shape adjustment can also be provided in the startshape directive. If it is provided then the shape is adjusted from the default state listed above before it is executed.
startshape JustACirclePlease[sat 1 b 1] // red circle
shape JustACirclePlease {
CIRCLE []
}
CFDG files can have multiple startshape directives and only the first will be used. The rules are the same for when there are multiple configuration variables declared: the first one is used; except when an imported file has a startshape directive, then the imported startshape is discarded if the importing cfdg file also has a startshape directive.
It doesn't really make sense to have multiple startshape directives in one file. But what does make sense is for included cfdg files to have a startshape directive that is ignored when it is included but used when it is by itself. This allows you to include another design and use some of its rules. This also lets you have a test rule for testing a library of rules like i_pix.cfdg or i_polygons.cfdg.