Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | stephen.tetley@gmail.com |
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.
- class OPlus t where
- oplus :: t -> t -> t
- oconcat :: OPlus t => t -> [t] -> t
- anterior :: OPlus t => t -> t -> t
- superior :: OPlus t => t -> t -> t
- data HAlign
- data VAlign
- type family MonUnit m :: *
- class Monad m => TraceM m where
- class (Applicative m, Monad m) => DrawingCtxM m where
- askDC :: m DrawingContext
- localize :: (DrawingContext -> DrawingContext) -> m a -> m a
- asksDC :: DrawingCtxM m => (DrawingContext -> a) -> m a
- class Monad m => PointSupplyM m where
- data HPrim u
- hprimToList :: HPrim u -> [Primitive u]
- singleH :: Primitive u -> HPrim u
- data PrimGraphic u
- getPrimGraphic :: PrimGraphic u -> Primitive u
- primGraphic :: Primitive u -> PrimGraphic u
- collectH :: PrimGraphic u -> HPrim u
Documentation
A Semigroup class.
Alignment.
Horizontal alignment - align to the top, center or bottom.
Vertical alignment - align to the left, center or bottom.
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.
class (Applicative m, Monad m) => DrawingCtxM m whereSource
askDC :: m DrawingContextSource
localize :: (DrawingContext -> DrawingContext) -> m a -> m aSource
DrawingCtxM CF | |
DrawingCtxM (TraceDrawing u) | |
Monad m => DrawingCtxM (TraceDrawingT u m) | |
DrawingCtxM m => DrawingCtxM (TurtleT u m) | |
DrawingCtxM m => DrawingCtxM (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.
(u ~ MonUnit m, Monad m, Num u) => PointSupplyM (TurtleT u m) |
Base types
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.
hprimToList :: HPrim u -> [Primitive u]Source
data PrimGraphic u Source
Eq u => Eq (PrimGraphic u) | |
Show u => Show (PrimGraphic u) | |
(Real u, Floating u) => Rotate (PrimGraphic u) | |
(Real u, Floating u) => RotateAbout (PrimGraphic u) | |
Num u => Scale (PrimGraphic u) | |
Num u => Translate (PrimGraphic u) | |
OPlus (PrimGraphic u) |
getPrimGraphic :: PrimGraphic u -> Primitive uSource
primGraphic :: Primitive u -> PrimGraphic uSource
collectH :: PrimGraphic u -> HPrim uSource