diagrams-0.2.2.3: An EDSL for creating simple diagrams

Portability portable experimental byorgey@gmail.com

Graphics.Rendering.Diagrams.Shapes

Description

Primitive shapes out of which `Diagram`s can be built, implemented via instances of `ShapeClass`.

Synopsis

# Documentation

`circle r` is a circle with radius `r`.

`arc r a1 a2` is a circular arc with radius `r`, starting at angle `a1*2*pi` and proceeding in a direction of increasing angle to `a2*2*pi`.

`regPolyPath n r` is an open path corresponding to a regular polygon, with the first vertex oriented along the positive x-axis and proceeding clockwise.

`regPoly n r` is a regular n-gon, with a circumcircle of radius `r`. One vertex is oriented along the positive x-axis.

`rotRegPoly n r a` is the same as `regPoly n r` but rotated through an angle of `a*2*pi` radians (i.e., `a` represents a fraction of an entire revolution). This is different than `rotate a \$ regPoly n r`; `rotRegPoly` will adjust the bounding box correctly (using `rotPath`), whereas the construction using `rotate` will still have a bounding box corresponding to the unrotated polygon.

`rect w h` is a rectangle of width `w` and height `h`.

`rectPath w h` is a closed path describing a rectangle of width `w` and height `h`.

`roundRect w h` is a rectangle of width `w` and height `h` with rounded corners having a radius one third the length of the shortest edge.

`roundRect w h f` is a rectangle of width `w` and height `h` with rounded corners having a radius `f` times the length of the shortest edge.

`straight` creates a `Diagram` from a path, by drawing straight lines along the path edges.

`curved d p` is a curved path which follows generally the path `p`. The parameter `d` specifies the amount of corner rounding. In particular, `d` should be a value between 0 and 1, which specifies what fraction of the path segments should be rounded off with bezier curves, using the path vertices as control points. Thus `d = 0` produces the polygonal path itself, with no curved segments; `d = 1` produces a continuously curving path tangent to the midpoints of the path segments; and intermediate values of `d` interpolate between the two. The curved path produced will be everywhere differentiable as long as `d > 0`. If the path is not closed, the curve will begin and end at the first and last path vertices (no rounding will take place at these vertices).

`textPath s t` is a string of text `t` at size `s`, represented as an outline with separate stroke and fill.

`rawCairo s r` is a diagram with bounding box size `s`, rendered by executing Cairo `Render` action `r`. Import Graphics.Rendering.Cairo to access Cairo operations.