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

Maintainer Malte Harder

Graphics.Craftwerk.Core.Figure

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

data Segment Source

Path creation

Constructors

 MoveTo Point LineSegment Point ArcSegment Point Double Double Double CurveSegment Point Point Point

Instances

 Eq Segment Show Segment

data Figure Source

The main datatype describing an arbitrary figure.

Instances

 Eq Figure Show Figure Monoid Figure

data Transform Source

Constructors

 Rotate Double Scale Vector Translate Vector

Instances

 Eq Transform Show Transform

Primitive wrappers

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

Applies a coordinate rotation.

Applies a coordinate scaling.

Applies a coordinate translation.

composition :: [Figure] -> FigureSource

Combines figures which are drawn in the order of the figures in the list.

Applies a style to the given figure

Generate a figure from a path.

Generates a MoveTo segment

Generates a LineSegment segment.

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.

Arguments

 :: Point End point of the segment. -> Point Control point 1. -> Point Control point 2. -> Segment

Generates a CurveSegment segment.

Converts a line to a figure

Generate a circle figure at a point with given radius.

Arguments

 :: Vector x,y -> Vector xs,ys -> Figure

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

Generate a text at (0,0)

Path generation

Arguments

 :: Point Origin -> Vector Extent -> Line

Construct a rectangle path from origin and extent.

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