Maintainer | Malte Harder <malte.harder@gmail.com> |
---|
A Figure
is a description of a 2D vector graphic. Affine transformations
and styles apply to all subfigures. When a subfigure of a style node contains
another style node the style properties will be overwritten where the deeper
node specifies it.
- type Point = (Double, Double)
- type Vector = Point
- type Line = [Point]
- type Path = [Segment]
- data Segment
- data Figure
- data Transform
- blank :: Figure
- canvas :: Figure -> Figure
- rotate :: Double -> Figure -> Figure
- scale :: Vector -> Figure -> Figure
- translate :: Vector -> Figure -> Figure
- composition :: [Figure] -> Figure
- style :: StyleProperties -> Figure -> Figure
- path :: Path -> Figure
- moveTo :: Point -> Segment
- lineTo :: Point -> Segment
- arc :: Point -> Double -> Double -> Double -> Segment
- curveTo :: Point -> Point -> Point -> Segment
- line :: Line -> Figure
- circle :: Point -> Double -> Figure
- grid :: Vector -> Vector -> Figure
- text :: String -> Figure
- point :: Double -> Double -> Point
- lineToPath :: Line -> Path
- rectangle :: Point -> Vector -> Line
- unitRectangle :: Line
Types and data types
Path creation
The main datatype describing an arbitrary figure.
Primitive wrappers
canvas :: Figure -> FigureSource
Transforms a coordinate transformation 'Transform t f' into a canvas transformation 'Canvas t f'.
composition :: [Figure] -> FigureSource
Combines figures which are drawn in the order of the figures in the list.
style :: StyleProperties -> Figure -> FigureSource
Applies a style to the given figure
lineTo :: Point -> SegmentSource
Generates a LineSegment
segment.
:: Point | Draws a line to this point unless segment is the first element in the path. |
-> Double | Start angle |
-> Double | End angle |
-> Double | Radius |
-> Segment |
Generates an ArcSegment
segment.
Generates a CurveSegment
segment.
Generate a grid spanning from (0,0) to (x,y) taking steps (xs,ys).
Point generation
Path generation
lineToPath :: Line -> PathSource
Construct a rectangle path from origin and extent.
Rectangle with origin (0,0) and extent (1,1)