wumpus-basic-0.15.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Kernel.Objects.TraceDrawing

Description

Drawing with trace - a Writer like monad collecting intermediate graphics - and drawing context - a reader monad of attributes - font_face, fill_colour etc.

Synopsis

Documentation

execTraceDrawing :: DrawingContext -> TraceDrawing u a -> HPrim uSource

Run the drawing returning only the output it produces, drop any answer from the monadic computation.

evalTraceDrawing :: DrawingContext -> TraceDrawing u a -> aSource

Run the drawing ignoring the output it produces, return the answer from the monadic computation.

Note - this useful for testing, generally one would want the opposite behaviour (return the drawing, ignore than the answer).

liftToPictureU :: (Real u, Floating u, FromPtSize u) => HPrim u -> Picture uSource

Unsafe promotion of HPrim to Picture.

If the HPrim is empty, a run-time error is thrown.

liftToPictureMb :: (Real u, Floating u, FromPtSize u) => HPrim u -> Maybe (Picture u)Source

Safe promotion of HPrim to (Maybe Picture).

If the HPrim is empty, then Nothing is returned.

mbPictureU :: (Real u, Floating u, FromPtSize u) => Maybe (Picture u) -> Picture uSource

Unsafe promotion of (Maybe Picture) to Picture.

This is equivalent to:

 fromMaybe (error "empty") $ pic

This function is solely a convenience, using it saves one import and a few characters.

If the supplied value is Nothing a run-time error is thrown.

query :: DrawingCtxM m => CF a -> m aSource

draw :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => Graphic u -> m ()Source

Draw a Graphic taking the drawing style from the drawing context.

This operation is analogeous to tell in a Writer monad.

xdraw :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => XLink -> Graphic u -> m ()Source

Hyperlink version of draw.

drawi :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => Image u a -> m aSource

Draw an Image taking the drawing style from the drawing context.

The graphic representation of the Image is drawn in the Trace monad, and the result is returned.

drawi_ :: (TraceM m, DrawingCtxM m, MonUnit m ~ u) => Image u a -> m ()Source

Forgetful drawi.

xdrawi :: (TraceM m, DrawingCtxM m, MonUnit m ~ u) => XLink -> Image u a -> m aSource

Hyperlink version of drawi.

xdrawi_ :: (TraceM m, DrawingCtxM m, MonUnit m ~ u) => XLink -> Image u a -> m ()Source

Forgetful xdrawi.

nodei :: (TraceM m, DrawingCtxM m, PointSupplyM m, MonUnit m ~ u) => LocImage u a -> m aSource