diagrams-0.2.1.3: An EDSL for creating simple diagrams

Portability portable experimental byorgey@gmail.com

Graphics.Rendering.Diagrams.Paths

Description

Type definitions and convenience functions for Graphics.Rendering.Diagrams, an embedded domain-specific language (EDSL) for creating simple diagrams.

Synopsis

# Documentation

The empty path, i.e. a path with no edges.

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.

pathToVertices :: Point -> Path -> [Point]Source

Convert a path into a list of vertices, starting with the given vertex.

pathToVectors :: Path -> [Vec]Source

Convert a path to a list of vectors corresponding to the edges of the path.

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).

Determine whether a `Path` is closed or open.

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.

Compute the size of a bounding box for the given `Path`, and the | offset of the starting vertex from the center.

Render a path using a particular style in the Cairo rendering monad.