wumpus-basic-0.13.0: Common drawing utilities built on wumpus-core.

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Graphic.Base

Contents

Description

The common base drawing objects in Wumpus-Basic - a semigroup class, monad classes (TraceM analogue to Writer, DrawingCtxM analogue to Reader), a wrapped Hughes list of primitives.

Synopsis

Documentation

class OPlus t whereSource

A Semigroup class.

Methods

oplus :: t -> t -> tSource

Instances

OPlus (Primitive u) 
Ord u => OPlus (BoundingBox u) 
OPlus (PrimGraphic u) 
OPlus a => OPlus (CF a) 
OPlus a => OPlus (r -> a) 
(OPlus a, OPlus b) => OPlus (a, b) 

oconcat :: OPlus t => t -> [t] -> tSource

anterior :: OPlus t => t -> t -> tSource

superior :: OPlus t => t -> t -> tSource

Alignment.

data HAlign Source

Horizontal alignment - align to the top, center or bottom.

Constructors

HTop 
HCenter 
HBottom 

data VAlign Source

Vertical alignment - align to the left, center or bottom.

Constructors

VLeft 
VCenter 
VRight 

Drawing monads.

type family MonUnit m :: *Source

DUnit is always for fully saturated type constructors, so (seemingly) an equivalent type family is needed for monads.

class Monad m => TraceM m whereSource

Collect elementary graphics as part of a larger drawing.

TraceM works much like a writer monad.

Methods

trace :: HPrim (MonUnit m) -> m ()Source

Instances

TraceM (TraceDrawing u) 
Monad m => TraceM (TraceDrawingT u m) 
(u ~ MonUnit m, Monad m, TraceM m) => TraceM (TurtleT u m) 
(u ~ MonUnit m, Monad m, TraceM m) => TraceM (ScalingT ux uy u m) 

asksDC :: DrawingCtxM m => (DrawingContext -> a) -> m aSource

Project a value out of a context.

class Monad m => PointSupplyM m whereSource

A monad that supplies points, e.g. a turtle monad.

Methods

position :: u ~ MonUnit m => m (Point2 u)Source

Instances

(u ~ MonUnit m, Monad m, Num u) => PointSupplyM (TurtleT u m) 

Base types

data HPrim u Source

Graphics objects, even simple ones (line, arrow, dot) might need more than one primitive (path or text label) for their construction. Hence, the primary representation that all the others are built upon must support concatenation of primitives.

Wumpus-Core has a type Picture - made from one or more Primitives - but Pictures include support for affine frames. For drawing many simple graphics (dots, connector lines...) that do not need individual affine transformations this is a penalty. A list of Primitives is therefore more suitable representation, and a Hughes list which supports efficient concatenation is wise.

Instances