diagrams-0.2.1.3: An EDSL for creating simple diagrams

Portabilityportable
Stabilityexperimental
Maintainerbyorgey@gmail.com

Graphics.Rendering.Diagrams.Shapes

Description

Primitive shapes out of which Diagrams can be built, implemented via instances of ShapeClass.

Synopsis

Documentation

circle :: Double -> DiagramSource

circle r is a circle with radius r.

arc :: Double -> Double -> Double -> DiagramSource

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 :: Int -> Double -> PathSource

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 :: Int -> Double -> DiagramSource

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

rotRegPoly :: Int -> Double -> Double -> DiagramSource

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 :: Double -> Double -> DiagramSource

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

rectPath :: Double -> Double -> PathSource

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

roundRect :: Double -> Double -> DiagramSource

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.

roundRectF :: Double -> Double -> Double -> DiagramSource

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 :: Path -> DiagramSource

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

curved :: Double -> Path -> DiagramSource

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 :: Double -> String -> DiagramSource

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

rawCairo :: Point -> Render () -> DiagramSource

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.