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

Stabilityhighly unstable




Extended Graphic object - an AdvanceGraphic is a Graphic twinned with and advance vector.


Advance vector

type AdvanceVec u = Vec2 uSource

Advance vectors provide an idiom for drawing consecutive graphics. PostScript uses them to draw left-to-right text - each character has an advance vector for the width and as characters are drawn they successively displace the start point for the next character with their advance vector.

Type alias for Vec2.

advanceH :: AdvanceVec u -> uSource

Extract the horizontal component of an advance vector.

For left-to-right latin text, the vertical component of an advance vector is expected to be 0. Ingoring it seems permissible when drawing text.

advanceV :: AdvanceVec u -> uSource

Extract the verticall component of an advance vector.

Advance-vector object and graphic

data AdvObject u Source

Advance vector graphic - this partially models the PostScript show command which moves the current point by the advance (width) vector as each character is drawn.


runAdvObject :: AdvObject u -> LocImage u (Vec2 u)Source

Run an AdvObject turning it into an LocImage.

makeAdvObject :: Query u (Vec2 u) -> LocGraphic u -> AdvObject uSource

makeAdvObject : loc_context_function * graphic -> AdvObject

Build an AdvObject from a context function (CF) that generates the answer displacement vector and a LocGraphic that draws the AdvObject.

emptyAdvObject :: InterpretUnit u => AdvObject uSource

emptyAdvObjectAU : AdvObject

Build an empty AdvObject.

The emptyAdvObject is treated as a null primitive by Wumpus-Core and is not drawn, the answer vector generated is the zero vector (V2 0 0).


advance :: Num u => AdvObject u -> AdvObject u -> AdvObject uSource

Draw the first AdvObject and use the advance vector to displace the second AdvObject.

The final answer is the sum of both advance vectors.

advances :: InterpretUnit u => [AdvObject u] -> AdvObject uSource

Concatenate the list of AdvObjects with advance.

advspace :: Num u => Vec2 u -> AdvObject u -> AdvObject u -> AdvObject uSource

Combine the AdvObjects using the answer vector of the first object plus the separator to move the start of the second object.

evenspace :: InterpretUnit u => Vec2 u -> [AdvObject u] -> AdvObject uSource

List version of nextSpace.

advrepeat :: InterpretUnit u => Int -> AdvObject u -> AdvObject uSource

Repeat the AdvObject n times, moving each time with advance.

punctuate :: InterpretUnit u => AdvObject u -> [AdvObject u] -> AdvObject uSource

Concatenate the list of AdvObjects, going next and adding the separator at each step.

advfill :: Num u => Vec2 u -> AdvObject u -> AdvObject uSource

Render the supplied AdvObject, but swap the result advance for the supplied vector. This function has behaviour analogue to fill in the wl-pprint library.