wumpus-core-0.12.0: Pure Haskell PostScript and SVG generation.

PortabilityGHC only
Stabilityexperimental
Maintainerstephen.tetley@gmail.com

Wumpus.Core.Picture

Contents

Description

 

Synopsis

Construction

blankPicture :: Num u => BoundingBox u -> Picture uSource

This module (Wumpus.Core.Picture) should be the only interface to the outside world for creating

Create a blank picture sized to the supplied bounding box. This is useful for spacing rows or columns of pictures.

frame :: (Fractional u, Ord u) => Primitive u -> Picture uSource

Lift a Primitive to a Picture, located in the standard frame.

frameWithin :: (Fractional u, Ord u) => Primitive u -> BoundingBox u -> Picture uSource

Frame a picture within the supplied bounding box

A text label uses the supplied bounding box as is - no clipping is performed if the bounding box is smaller than the boundary size of the text. This may cause strange overlap for subsequent composite pictures, and incorrect bounding box annotations in the prologue of the generated EPS file.

Paths and ellipses are bound within the union of the supplied bounding box and the inherent bounding box or the path or ellipse. Thus the bounding box will never reframed to a smaller size than the natural bounding box.

frameMulti :: (Fractional u, Ord u) => [Primitive u] -> Picture uSource

Lift a list of Primitives to a composite Picture, all Primitives will be located within the standard frame. The list of Primitives must be non-empty.

multi :: (Fractional u, Ord u) => [Picture u] -> Picture uSource

Place multiple pictures within the same affine frame This function throws an error when supplied the empty list.

path :: Point2 u -> [PathSegment u] -> Path uSource

Create a Path from the start point and alist of PathSegments.

lineTo :: Point2 u -> PathSegment uSource

Create a straight-line PathSegment.

curveTo :: Point2 u -> Point2 u -> Point2 u -> PathSegment uSource

Create a curved PathSegment.

vertexPath :: [Point2 u] -> Path uSource

Convert the list of vertices to a path of straight line segments.

curvedPath :: [Point2 u] -> Path uSource

Convert a list of vertices to a path of curve segments. The first point in the list makes the start point, each curve segment thereafter takes 3 points. Spare points at the end are discarded.

Constructing primitives

zostroke :: (Num u, Ord u) => Path u -> Primitive uSource

Create an open stoke coloured black.

zcstroke :: (Num u, Ord u) => Path u -> Primitive uSource

Create a closed stroke coloured black.

class Fill t whereSource

Methods

fill :: (Num u, Ord u) => t -> Path u -> Primitive uSource

Instances

zfill :: (Num u, Ord u) => Path u -> Primitive uSource

Create a filled path coloured black.

clip :: (Num u, Ord u) => Path u -> Picture u -> Picture uSource

ztextlabel :: Point2 u -> String -> Primitive uSource

Create a label where the font is Courier, text size is 10 and colour is black.

class Ellipse t whereSource

Instances will create a filled ellipse unless the supplied element implies a stoked ellipse, e.g.:

 ellipse (LineWidth 4) zeroPt 40 40 
 ellipse EFill zeroPt 40 40  

Methods

ellipse :: Fractional u => t -> Point2 u -> u -> u -> Primitive uSource

zellipse :: Num u => Point2 u -> u -> u -> Primitive uSource

Create a black, filled ellipse.

Operations

extendBoundary :: (Num u, Ord u) => u -> u -> Picture u -> Picture uSource

Extend the bounding box of a picture.

The bounding box is both horizontal directions by x and both vertical directions by y. x and y must be positive This function cannot be used to shrink a boundary.