Portability | portable |
---|---|
Stability | experimental |
Maintainer | byorgey@gmail.com |
Safe Haskell | None |
Type definitions and convenience functions for Graphics.Rendering.Diagrams, an embedded domain-specific language (EDSL) for creating simple diagrams.
Documentation
pathFromVertices :: [Point] -> PathSource
Create an open path from a list of vertices. For example,
pathFromVertices [(1,3), (4,4), (6,5)]
describes the path with
two segments which starts at (1,3), has a corner at (4,4), and
ends at (6,5). Note, however, that the vertices themselves are
not significant, only the distances between them. That is,
pathFromVertices [(0,1), (3,2), (5,3)]
describes exactly the
same path.
pathFromVectors :: [Vec] -> PathSource
Create an open path from a list of edge displacement vectors.
For example, pathFromVectors [(1,1), (3,4)]
describes the path
with two segments which first moves one unit in the positive x
and y directions, and then moves three units in the positive x
direction and four in the positive y direction.
pathConcat :: Path -> Path -> PathSource
Concatenate two open paths into a single open path consisting of the first followed by the second.
Create a closed path (by connecting the first and last points in the path).
rotPath :: Double -> Path -> PathSource
Rotate a path by a fraction of a circle. rotPath d
rotates
paths by an angle of d*2*pi
radians. Note that creating a
Diagram
from a Path
(using straight
or curved
or some
other such function) and then applying rotate
to it is
different than first applying rotPath
to the Path
before
making it into a Diagram
. In the latter case, the bounding box
will be correct, whereas in the former case, the bounding box
will still correspond to the unrotated version of the path.
pathSizeAndOffset :: Path -> (Vec, Point)Source
Compute the size of a bounding box for the given Path
, and the
| offset of the starting vertex from the center.
renderPath :: PathStyle -> Path -> Render ()Source
Render a path using a particular style in the Cairo rendering monad.