Portability | GHC with TypeFamilies and more |
---|---|
Stability | unstable |
Maintainer | stephen.tetley@gmail.com |
Construction of pictures, paths and text labels.
- blankPicture :: Num u => BoundingBox u -> Picture u
- frame :: (Fractional u, Ord u) => Primitive u -> Picture u
- frameWithin :: (Fractional u, Ord u) => Primitive u -> BoundingBox u -> Picture u
- frameMulti :: (Fractional u, Ord u) => [Primitive u] -> Picture u
- multi :: (Fractional u, Ord u) => [Picture u] -> Picture u
- path :: Point2 u -> [PathSegment u] -> Path u
- lineTo :: Point2 u -> PathSegment u
- curveTo :: Point2 u -> Point2 u -> Point2 u -> PathSegment u
- vertexPath :: [Point2 u] -> Path u
- curvedPath :: [Point2 u] -> Path u
- class Stroke t where
- zostroke :: (Num u, Ord u) => Path u -> Primitive u
- zcstroke :: (Num u, Ord u) => Path u -> Primitive u
- class Fill t where
- zfill :: (Num u, Ord u) => Path u -> Primitive u
- clip :: (Num u, Ord u) => Path u -> Picture u -> Picture u
- class TextLabel t where
- ztextlabel :: String -> Point2 u -> Primitive u
- class Ellipse t where
- ellipse :: Fractional u => t -> u -> u -> Point2 u -> Primitive u
- zellipse :: Num u => u -> u -> Point2 u -> Primitive u
- extendBoundary :: (Num u, Ord u) => u -> u -> Picture u -> Picture u
- movePic :: Num u => Vec2 u -> Picture u -> Picture u
- picOver :: (Num u, Ord u) => Picture u -> Picture u -> Picture u
Construction
blankPicture :: Num u => BoundingBox u -> Picture uSource
Create a blank Picture
sized to the supplied bounding box.
This is useful for spacing rows or columns of pictures.
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.
This function throws an error when supplied the empty list.
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 a start point and a list of PathSegments.
lineTo :: Point2 u -> PathSegment uSource
Create a straight-line 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
Create a open, stroked path (ostroke
) or a closed, stroked
path (cstroke
).
ostroke
and cstroke
are overloaded to make attributing
the path more convenient.
ostroke :: (Num u, Ord u) => t -> Path u -> Primitive uSource
cstroke :: (Num u, Ord u) => t -> Path u -> Primitive uSource
Stroke () | |
Stroke StrokeAttr | |
Stroke [StrokeAttr] | |
Stroke (Gray Double) | |
Stroke (HSB3 Double) | |
Stroke (RGB3 Double) | |
Stroke (Gray Double, [StrokeAttr]) | |
Stroke (Gray Double, StrokeAttr) | |
Stroke (HSB3 Double, [StrokeAttr]) | |
Stroke (HSB3 Double, StrokeAttr) | |
Stroke (RGB3 Double, [StrokeAttr]) | |
Stroke (RGB3 Double, StrokeAttr) |
Create a filled path (fill
). Fills only have one
property - colour. But there are various representations of
colour.
fill ()
will fill with the default colour - black.
clip :: (Num u, Ord u) => Path u -> Picture u -> Picture uSource
Clip a picture with respect to the supplied path.
Create a text label. The string should not contain newline
or tab characters. Use multilabel
to create text with
multiple lines.
textlabel
is overloaded to make attributing the label more
convenient.
Unless a FontAttr
is specified, the label will use 12pt
Courier.
The supplied point is is the bottom left corner.
ztextlabel :: String -> Point2 u -> Primitive uSource
Create a label where the font is Courier
, text size is 10
and colour is black.
Create an ellipse, the ellipse will be filled unless the supplied attributes imply a stoked ellipse, e.g.:
ellipse (LineWidth 4) zeroPt 40 40
Note - within Wumpus, ellipses are considered an unfortunate
but useful optimization. Drawing good cicles with Beziers
needs at least eight curves, but drawing them with
PostScript's arc
command is a single operation. For
drawings with many dots (e.g. scatter plots) it seems sensible
to employ this optimaztion.
A deficiency of Wumpus's ellipse is that (non-uniformly) scaling a stroked ellipse also (non-uniformly) scales the pen it is drawn with. Where the ellipse is wider, the pen stroke will be wider too.
ellipse :: Fractional u => t -> u -> u -> Point2 u -> Primitive uSource
Ellipse () | |
Ellipse StrokeAttr | |
Ellipse DrawEllipse | |
Ellipse [StrokeAttr] | |
Ellipse (Gray Double) | |
Ellipse (HSB3 Double) | |
Ellipse (RGB3 Double) | |
Ellipse (Gray Double, [StrokeAttr]) | |
Ellipse (Gray Double, StrokeAttr) | |
Ellipse (Gray Double, DrawEllipse) | |
Ellipse (HSB3 Double, [StrokeAttr]) | |
Ellipse (HSB3 Double, StrokeAttr) | |
Ellipse (HSB3 Double, DrawEllipse) | |
Ellipse (RGB3 Double, [StrokeAttr]) | |
Ellipse (RGB3 Double, StrokeAttr) | |
Ellipse (RGB3 Double, DrawEllipse) |
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.