Portability | GHC |
---|---|
Stability | unstable |
Maintainer | stephen.tetley@gmail.com |
Drawing with trace - a Writer like monad collecting intermediate graphics - and drawing context - a reader monad of attributes - font_face, fill_colour etc.
- data Drawing u a
- data DrawingT u m a
- runDrawing :: DrawingContext -> Drawing u a -> (a, HPrim u)
- execDrawing :: DrawingContext -> Drawing u a -> HPrim u
- runDrawingT :: Monad m => DrawingContext -> DrawingT u m a -> m (a, HPrim u)
- execDrawingT :: Monad m => DrawingContext -> DrawingT u m a -> m (HPrim u)
- runFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> (a, Maybe (Picture u))
- execFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> Maybe (Picture u)
- runFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (a, Maybe (Picture u))
- execFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (Maybe (Picture u))
- liftToPictureU :: (Real u, Floating u, FromPtSize u) => HPrim u -> Picture u
- liftToPictureMb :: (Real u, Floating u, FromPtSize u) => HPrim u -> Maybe (Picture u)
- mbPictureU :: (Real u, Floating u, FromPtSize u) => Maybe (Picture u) -> Picture u
- draw :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => Graphic u -> m ()
- xdraw :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => XLink -> Graphic u -> m ()
- drawi :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => Image u a -> m a
- xdrawi :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => XLink -> Image u a -> m a
- at :: LocGraphic u -> Point2 u -> Graphic u
- ati :: LocImage u a -> Point2 u -> Image u a
- conn :: ConnImage u a -> Point2 u -> LocImage u a
- node :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ MonUnit m) => LocGraphic u -> m ()
- nodei :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ MonUnit m) => LocImage u a -> m a
Documentation
Monad (Drawing u) | |
Functor (Drawing u) | |
Applicative (Drawing u) | |
DrawingCtxM (Drawing u) | |
TraceM (Drawing u) |
runDrawing :: DrawingContext -> Drawing u a -> (a, HPrim u)Source
execDrawing :: DrawingContext -> Drawing u a -> HPrim uSource
runDrawingT :: Monad m => DrawingContext -> DrawingT u m a -> m (a, HPrim u)Source
execDrawingT :: Monad m => DrawingContext -> DrawingT u m a -> m (HPrim u)Source
runFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> (a, Maybe (Picture u))Source
Run the Drawing generating a Picture within a "font delta context" using the font-family and font-size from the intial DrawingContext.
Using a font delta context can reduce the code size of the generated SVG file (PostScript ignores the FDC).
execFdcDrawing :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Drawing u a -> Maybe (Picture u)Source
exec version of runFdcContext
.
runFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (a, Maybe (Picture u))Source
Transformer version of runFdcDrawing
.
execFdcDrawingT :: (Real u, Floating u, FromPtSize u, Monad m) => DrawingContext -> DrawingT u m a -> m (Maybe (Picture u))Source
Transformer version of execFdcDrawing
.
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.
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.
xdrawi :: (TraceM m, DrawingCtxM m, u ~ MonUnit m) => XLink -> Image u a -> m aSource
Hyperlink version of drawi
.
at :: LocGraphic u -> Point2 u -> Graphic uSource
node :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ MonUnit m) => LocGraphic u -> m ()Source
nodei :: (TraceM m, DrawingCtxM m, PointSupplyM m, u ~ MonUnit m) => LocImage u a -> m aSource