Portability | GHC |
---|---|

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

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

- type AdvGraphic u = LocImage u (Vec2 u)
- type DAdvGraphic = AdvGraphic Double
- intoAdvGraphic :: LocCF u (Vec2 u) -> LocGraphic u -> AdvGraphic u
- emptyAdvGraphic :: Num u => AdvGraphic u
- advcat :: Num u => AdvGraphic u -> AdvGraphic u -> AdvGraphic u
- advsep :: Num u => Vec2 u -> AdvGraphic u -> AdvGraphic u -> AdvGraphic u
- advconcat :: Num u => [AdvGraphic u] -> AdvGraphic u
- advspace :: Num u => Vec2 u -> [AdvGraphic u] -> AdvGraphic u
- advpunctuate :: Num u => AdvGraphic u -> [AdvGraphic u] -> AdvGraphic u
- advfill :: Num u => Vec2 u -> AdvGraphic u -> AdvGraphic u

# Advance-vector graphic

type AdvGraphic u = LocImage u (Vec2 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.

type DAdvGraphic = AdvGraphic DoubleSource

intoAdvGraphic :: LocCF u (Vec2 u) -> LocGraphic u -> AdvGraphic uSource

`intoAdvGraphic`

: ` loc_context_function * graphic -> Image `

Build an `AdvGraphic`

from a context function (`CF`

) that
generates the answer displacement vector and a `LocGraphic`

that draws the `AdvGraphic`

.

emptyAdvGraphic :: Num u => AdvGraphic uSource

`emptyAdvGraphic`

: ` AdvGraphic `

Build an empty `AdvGraphic`

.

The `emptyAdvGraphic`

is treated as a *null primitive* by
`Wumpus-Core`

and is not drawn, the answer vetor generated is
the empty vector `(V2 0 0)`

.

# Composition

advcat :: Num u => AdvGraphic u -> AdvGraphic u -> AdvGraphic uSource

Concatenate the two AdvGraphics.

advsep :: Num u => Vec2 u -> AdvGraphic u -> AdvGraphic u -> AdvGraphic uSource

Concatenate the two AdvGraphics spacing them by the supplied vector.

advconcat :: Num u => [AdvGraphic u] -> AdvGraphic uSource

Concatenate the list of AdvGraphic with `advcat`

.

advspace :: Num u => Vec2 u -> [AdvGraphic u] -> AdvGraphic uSource

Concatenate the list of AdvGraphic with `advsep`

.

advpunctuate :: Num u => AdvGraphic u -> [AdvGraphic u] -> AdvGraphic uSource

Concatenate the list of AdvGraphic with `advsep`

.

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

Render the supplied AdvGraphic, but swap the result advance
for the supplied vector. This function has behaviour analogue
to `fill`

in the `wl-pprint`

library.