Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | stephen.tetley@gmail.com |
Extended Graphic object - an AdvanceGraphic is a Graphic twinned with and advance vector.
- data AdvObject u
- type DAdvObject = AdvObject Double
- type AdvGraphic u = LocImage u (Vec2 u)
- type DAdvGraphic = AdvGraphic Double
- makeAdvObject :: Query (Vec2 u) -> LocGraphic u -> AdvObject u
- emptyAdvObject :: InterpretUnit u => AdvObject u
- runAdvObjectR0 :: Point2 u -> AdvObject u -> Image u (Vec2 u)
- runAdvObjectR1 :: AdvObject u -> AdvGraphic u
- advance :: Num u => AdvObject u -> AdvObject u -> AdvObject u
- advances :: InterpretUnit u => [AdvObject u] -> AdvObject u
- advspace :: Num u => Vec2 u -> AdvObject u -> AdvObject u -> AdvObject u
- evenspace :: InterpretUnit u => Vec2 u -> [AdvObject u] -> AdvObject u
- advrepeat :: InterpretUnit u => Int -> AdvObject u -> AdvObject u
- punctuate :: InterpretUnit u => AdvObject u -> [AdvObject u] -> AdvObject u
- advfill :: Num u => Vec2 u -> AdvObject u -> AdvObject u
Advance-vector object and graphic
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.
InterpretUnit u => Monoid (AdvObject u) |
type DAdvObject = AdvObject DoubleSource
type AdvGraphic u = LocImage u (Vec2 u)Source
type DAdvGraphic = AdvGraphic DoubleSource
makeAdvObject :: Query (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)
.
runAdvObjectR1 :: AdvObject u -> AdvGraphic uSource
Composition
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
.