craftwerk-0.1: 2D graphics library with integrated TikZ output.

MaintainerMalte Harder <malte.harder@gmail.com>

Graphics.Craftwerk.Core.Figure

Contents

Description

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.

Synopsis

Types and data types

type Line = [Point]Source

Primitive wrappers

canvas :: Figure -> FigureSource

Transforms a coordinate transformation 'Transform t f' into a canvas transformation 'Canvas t f'.

rotate :: Double -> Figure -> FigureSource

Applies a coordinate rotation.

scale :: Vector -> Figure -> FigureSource

Applies a coordinate scaling.

translate :: Vector -> Figure -> FigureSource

Applies a coordinate translation.

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

path :: Path -> FigureSource

Generate a figure from a path.

moveTo :: Point -> SegmentSource

Generates a MoveTo segment

lineTo :: Point -> SegmentSource

Generates a LineSegment segment.

arcSource

Arguments

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

curveToSource

Arguments

:: Point

End point of the segment.

-> Point

Control point 1.

-> Point

Control point 2.

-> Segment 

Generates a CurveSegment segment.

line :: Line -> FigureSource

Converts a line to a figure

circle :: Point -> Double -> FigureSource

Generate a circle figure at a point with given radius.

gridSource

Arguments

:: Vector

x,y

-> Vector

xs,ys

-> Figure 

Generate a grid spanning from (0,0) to (x,y) taking steps (xs,ys).

text :: String -> FigureSource

Generate a text at (0,0)

Point generation

Path generation

rectangleSource

Arguments

:: Point

Origin

-> Vector

Extent

-> Line 

Construct a rectangle path from origin and extent.

unitRectangle :: LineSource

Rectangle with origin (0,0) and extent (1,1)