Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Drawing attributes
** WARNING ** - The drawing context modules need systematic
naming schemes both for update functions (primaryColour, ...)
and for synthesized selectors (e.g. lowerxHeight). The current
names in QueryDC
and UpdateDC
are expected to change.
- data DrawingContext = DrawingContext {}
- type DrawingContextF = DrawingContext -> DrawingContext
- data TextMargin = TextMargin {
- text_margin_x :: !Double
- text_margin_y :: !Double
- standardContext :: FontSize -> DrawingContext
- metricsContext :: FontSize -> GlyphMetrics -> DrawingContext
- default_drawing_context :: DrawingContext
- 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
- withFontMetrics :: (MetricsOps -> PtSize -> u) -> DrawingContext -> u
Drawing context
data DrawingContext Source
DrawingContext
- the "graphics state" of Wumpus-Basic.
DrawingContext is operated on within a Reader monad rather than
a State monad so "updates" are delineated within a local
operation (called localize
in Wumpus), rather than permanent
until overridden as per set
of a State monad.
Note - round_corner_factor
is only accounted for by some
graphic objects (certain Path objects and Shapes in
Wumpus-Drawing for instance). There many be many objects that
ignore it and are drawn only with angular corners.
Also note - in contrast to most other drawing objects in
Wumpus, none of the measurement values are parameteric -
usually notated with the type variable u
in Wumpus. This is
so Wumpus can (potentially) support different units e.g.
centimeters rather than just Doubles (represening printers
points), though adding support for other units has a very low
priority.
type DrawingContextF = DrawingContext -> DrawingContextSource
Type synonym for DrawingContext update functions.
data TextMargin Source
The unit of Margin is always Double representing Points, e.g. 1.0 is 1 Point. Margins are not scaled relative to the current font size.
The default value is 2 point.
TextMargin | |
|
DrawingCtxM (reader) monad
class (Applicative m, Monad m) => DrawingCtxM m whereSource
askDC :: m DrawingContextSource
localize :: (DrawingContext -> DrawingContext) -> m a -> m aSource
DrawingCtxM CF | |
DrawingCtxM (CF1 r1) | |
DrawingCtxM (TraceDrawing u) | |
DrawingCtxM (CF2 r1 r2) | |
Monad m => DrawingCtxM (TraceDrawingT u m) |
asksDC :: DrawingCtxM m => (DrawingContext -> a) -> m aSource
Project a value out of a context.
Glyph metrics
withFontMetrics :: (MetricsOps -> PtSize -> u) -> DrawingContext -> uSource