Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | stephen.tetley@gmail.com |
Safe Haskell | Safe-Infered |
The elementary base types and classes.
- quarter_pi :: Radian
- half_pi :: Radian
- two_pi :: Radian
- ang180 :: Radian
- ang150 :: Radian
- ang120 :: Radian
- ang90 :: Radian
- ang60 :: Radian
- ang45 :: Radian
- ang30 :: Radian
- ang15 :: Radian
- data UNil u = UNil
- ureturn :: Monad m => m (UNil u)
- uvoid :: Monad m => m a -> m (UNil u)
- class ScalarUnit a where
- fromPsPoint :: Double -> a
- toPsPoint :: a -> Double
- class (Eq u, Num u) => InterpretUnit u where
- dinterpF :: (Functor t, InterpretUnit u) => FontSize -> t Double -> t u
- normalizeF :: (Functor t, InterpretUnit u) => FontSize -> t u -> t Double
- uconvert1 :: (InterpretUnit u, InterpretUnit u1) => FontSize -> u -> u1
- uconvertF :: (Functor t, InterpretUnit u, InterpretUnit u1) => FontSize -> t u -> t u1
- intraMapPoint :: InterpretUnit u => FontSize -> (DPoint2 -> DPoint2) -> Point2 u -> Point2 u
- intraMapFunctor :: (Functor f, InterpretUnit u) => FontSize -> (f Double -> f Double) -> f u -> f u
- type KernChar u = (u, EscapedChar)
- data PathMode
- = OSTROKE
- | CSTROKE
- | CFILL
- | CFILL_STROKE
- data DrawMode
- closedMode :: DrawMode -> PathMode
- data ZOrder
- data HAlign
- data VAlign
- data TextHeight
- data Cardinal
- = NORTH
- | NORTH_EAST
- | EAST
- | SOUTH_EAST
- | SOUTH
- | SOUTH_WEST
- | WEST
- | NORTH_WEST
- data Direction
- data ClockDirection
- clockDirection :: (Real u, Floating u) => Vec2 u -> Vec2 u -> ClockDirection
- data HDirection
- = LEFTWARDS
- | RIGHTWARDS
- horizontalDirection :: Radian -> HDirection
- data VDirection
- verticalDirection :: Radian -> VDirection
- data Quadrant
- quadrant :: Radian -> Quadrant
- bezierArcPoints :: Floating u => Radian -> u -> Radian -> Point2 u -> [Point2 u]
- bezierMinorArc :: Floating u => Radian -> u -> Radian -> Point2 u -> (Point2 u, Point2 u, Point2 u, Point2 u)
- both :: Applicative f => f a -> f b -> f (a, b)
- monPreRepeatPost :: Monoid a => a -> (Int, a) -> a -> a
Constants
Unit phantom type
The empty data type - i.e. ()
- wrapped with a phantom unit
parameter.
ureturn :: Monad m => m (UNil u)Source
Return a UNil
rather than ()
at the end of sequence of
monadic commands.
Many Wumpus objects are usefully constructed in the
do-notation
, but because Wumpus has to expose the type of
the unit
to the type checker we must finish the do-block
with:
ureturn
or:
return UNil
rather than:
return ()
Non-contextual unit conversion.
class ScalarUnit a whereSource
Unit interpretation with respect to the current Point size
class (Eq u, Num u) => InterpretUnit u whereSource
dinterpF :: (Functor t, InterpretUnit u) => FontSize -> t Double -> t uSource
dinterp
an object that gives access to its unit at the
functor position.
normalizeF :: (Functor t, InterpretUnit u) => FontSize -> t u -> t DoubleSource
normalize
an object that gives access to its unit at the
functor position.
uconvert1 :: (InterpretUnit u, InterpretUnit u1) => FontSize -> u -> u1Source
Convert a scalar value from one unit to another.
uconvertF :: (Functor t, InterpretUnit u, InterpretUnit u1) => FontSize -> t u -> t u1Source
Unit convert an object that gives access to its unit at the Functor position.
In practive this will be *all* Image answers.
intraMapPoint :: InterpretUnit u => FontSize -> (DPoint2 -> DPoint2) -> Point2 u -> Point2 uSource
intraMapFunctor :: (Functor f, InterpretUnit u) => FontSize -> (f Double -> f Double) -> f u -> f uSource
KernChar
type KernChar u = (u, EscapedChar)Source
Unit parametric version of KerningChar from Wumpus-Core.
Drawing paths and shapes (closed paths)
Draw closed paths.
OSTROKE - open and stroked
CSTROKE - closed and stroke
CFILL - closed and filled
CFILL_STROKE - closed, the path is filled, its edge is stroked.
Draw closed paths and shapes.
DRAW_STROKE - closed and stroked
DRAW_FILL - closed and filled
DRAW_FILL_STROKE - the path is filled, its edge is stroked.
closedMode :: DrawMode -> PathModeSource
Interpret a DrawMode
for a closed path.
Drawing layers
Enumerated type for drawing with respect to the z-order.
Alignment
Horizontal alignment - align to the top, center or bottom.
Vertical alignment - align to the left, center or bottom.
Text height
data TextHeight Source
Wumpus distinguishes two use-cases for displaying vertically centered text.
Arbitrary text that is expected to contain lower case letters with descenders, show take the vertical center as the mid-point between the cap height and the descender depth.
Unfortunately, including the descender depth can produce unbalanced results for text which is not expected to have descenders (e.g. numbers within a bordered box), visually this makes the center too high.
Cardinal (compass) positions
An enumeratied type representing the compass positions.
Direction enumeration
An enumerated type representing horizontal and vertical directions.
data ClockDirection Source
An enumerated type representing clock directions.
clockDirection :: (Real u, Floating u) => Vec2 u -> Vec2 u -> ClockDirectionSource
Note - behaviour at the continuity (0 deg, 180 deg, ...) is unspecified.
data HDirection Source
An enumerated type representing horizontal direction.
data VDirection Source
An enumerated type representing vertical direction.
Quadrant enumeration
An enumerated type representing quadrants.
Beziers
bezierArcPoints :: Floating u => Radian -> u -> Radian -> Point2 u -> [Point2 u]Source
bezierArcPoints
: apex_angle * radius * inclination * center -> [Point]
ang should be in the range 0 < ang < 360deg.
if 0 < ang <= 90 returns 4 points if 90 < ang <= 180 returns 7 points if 180 < ang <= 270 returns 10 points if 270 < ang < 360 returns 13 points
bezierMinorArc :: Floating u => Radian -> u -> Radian -> Point2 u -> (Point2 u, Point2 u, Point2 u, Point2 u)Source
bezierMinorArc
: apex_angle * radius * rotation * center -> BezierCurve
ang should be in the range 0 < ang <= 90deg.
Misc
both :: Applicative f => f a -> f b -> f (a, b)Source
Applicative both - run both computations return the pair of the the answers.
monPreRepeatPost :: Monoid a => a -> (Int, a) -> a -> aSource
Monodial scheme - prefix, repeat body n times, suffix.