Portability | portable |
---|---|
Stability | experimental |
Maintainer | byorgey@gmail.com |
Primitive shapes out of which Diagram
s can be built, implemented
via instances of ShapeClass
.
- circle :: Double -> Diagram
- arc :: Double -> Double -> Double -> Diagram
- regPolyPath :: Int -> Double -> Path
- regPoly :: Int -> Double -> Diagram
- rotRegPoly :: Int -> Double -> Double -> Diagram
- rect :: Double -> Double -> Diagram
- rectPath :: Double -> Double -> Path
- roundRect :: Double -> Double -> Diagram
- roundRectF :: Double -> Double -> Double -> Diagram
- straight :: Path -> Diagram
- curved :: Double -> Path -> Diagram
- textPath :: Double -> String -> Diagram
- rawCairo :: Point -> Render () -> Diagram
Documentation
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
but rotated
through an angle of regPoly
n ra*2*pi
radians (i.e., a
represents a
fraction of an entire revolution). This is different than
; rotate
a $ regPoly
n rrotRegPoly
will adjust the
bounding box correctly (using rotPath
), whereas the
construction using rotate
will still have a bounding box
corresponding to the unrotated polygon.
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).