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

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

Graphic type - this is largely equivalent to Primitive in Wumpus-Core, but drawing attributes are implicitly supplied by the DrawingContext.

API in `Wumpus.Core`

, but here they exploit the implicit
`DrawingContext`

.

- type Graphic u = Image u (UNil u)
- type DGraphic = Graphic Double
- type LocGraphic u = LocImage u (UNil u)
- type DLocGraphic = LocGraphic Double
- type LocThetaGraphic u = LocThetaImage u (UNil u)
- type DLocThetaGraphic = LocThetaGraphic Double
- intoImage :: CF a -> Graphic u -> Image u a
- intoLocImage :: LocCF u a -> LocGraphic u -> LocImage u a
- intoLocThetaImage :: LocThetaCF u a -> LocThetaGraphic u -> LocThetaImage u a
- moveStartPoint :: PointDisplace u -> LocCF u a -> LocCF u a
- moveStartPointTheta :: PointDisplace u -> LocThetaCF u a -> LocThetaCF u a
- locPath :: Num u => [Vec2 u] -> LocCF u (PrimPath u)
- emptyLocPath :: Num u => LocCF u (PrimPath u)
- emptyLocGraphic :: Num u => LocGraphic u
- openStroke :: Num u => PrimPath u -> Graphic u
- closedStroke :: Num u => PrimPath u -> Graphic u
- filledPath :: Num u => PrimPath u -> Graphic u
- borderedPath :: Num u => PrimPath u -> Graphic u
- textline :: Num u => String -> LocGraphic u
- rtextline :: Num u => String -> LocThetaGraphic u
- escapedline :: Num u => EscapedText -> LocGraphic u
- rescapedline :: Num u => EscapedText -> LocThetaGraphic u
- hkernline :: Num u => [KerningChar u] -> LocGraphic u
- vkernline :: Num u => [KerningChar u] -> LocGraphic u
- strokedEllipse :: Num u => u -> u -> LocGraphic u
- rstrokedEllipse :: Num u => u -> u -> LocThetaGraphic u
- filledEllipse :: Num u => u -> u -> LocGraphic u
- rfilledEllipse :: Num u => u -> u -> LocThetaGraphic u
- borderedEllipse :: Num u => u -> u -> LocGraphic u
- rborderedEllipse :: Num u => u -> u -> LocThetaGraphic u
- straightLine :: Fractional u => Vec2 u -> LocGraphic u
- straightLineBetween :: Fractional u => Point2 u -> Point2 u -> Graphic u
- curveBetween :: Fractional u => Point2 u -> Point2 u -> Point2 u -> Point2 u -> Graphic u
- strokedRectangle :: Fractional u => u -> u -> LocGraphic u
- filledRectangle :: Fractional u => u -> u -> LocGraphic u
- borderedRectangle :: Fractional u => u -> u -> LocGraphic u
- strokedCircle :: Floating u => Int -> u -> LocGraphic u
- filledCircle :: Floating u => Int -> u -> LocGraphic u
- borderedCircle :: Floating u => Int -> u -> LocGraphic u
- strokedDisk :: Num u => u -> LocGraphic u
- filledDisk :: Num u => u -> LocGraphic u
- borderedDisk :: Num u => u -> LocGraphic u

# Documentation

type Graphic u = Image u (UNil u)Source

Simple drawing - produce a primitive, access the DrawingContext as required, e.g for fill colour, stroke colur, line width, etc.

# LocGraphic

type LocGraphic u = LocImage u (UNil u)Source

*Originated* drawing - produce a primitive respective to the
supplied start-point, access the DrawingContext as required.

type DLocGraphic = LocGraphic DoubleSource

Alias of `LocGraphic`

where the unit type is specialized to
Double.

type LocThetaGraphic u = LocThetaImage u (UNil u)Source

*Originated* drawing - produce a primitive respective to the
supplied start-point, access the DrawingContext as required.

type DLocThetaGraphic = LocThetaGraphic DoubleSource

Alias of `LocThetaGraphic`

where the unit type is specialized
to Double.

# Functions

intoLocImage :: LocCF u a -> LocGraphic u -> LocImage u aSource

Build a LocImage...

intoLocThetaImage :: LocThetaCF u a -> LocThetaGraphic u -> LocThetaImage u aSource

Build a LocThetaImage...

moveStartPoint :: PointDisplace u -> LocCF u a -> LocCF u aSource

Move the start-point of a LocImage with the supplied displacement function.

moveStartPointTheta :: PointDisplace u -> LocThetaCF u a -> LocThetaCF u aSource

Move the start-point of a LocImage with the supplied displacement function.

locPath :: Num u => [Vec2 u] -> LocCF u (PrimPath u)Source

This is the analogue to `vectorPath`

in `Wumpus-core`

.

emptyLocPath :: Num u => LocCF u (PrimPath u)Source

This is the analogue to `emptyPath`

in `Wumpus-core`

.

emptyLocGraphic :: Num u => LocGraphic uSource

Build an empty LocGraphic - this is a path with a start point but no path segments.

The `emptyLocGraphic`

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

and is not drawn, although it does generate a
minimum bounding box at the implicit start point.

openStroke :: Num u => PrimPath u -> Graphic uSource

`openStroke`

: ` path -> Graphic `

This is the analogue to `ostroke`

in `Wumpus-core`

, but the
drawing properties (colour, line width, etc.) are taken from
the implicit `DrawingContext`

.

closedStroke :: Num u => PrimPath u -> Graphic uSource

`closedStroke`

: ` path -> Graphic `

This is the analogue to `cstroke`

in `Wumpus-core`

, but the
drawing properties (colour, line width, etc.) are taken from
the implicit `DrawingContext`

.

filledPath :: Num u => PrimPath u -> Graphic uSource

`filledPath`

: ` path -> Graphic `

This is the analogue to `fill`

in `Wumpus-core`

, but the
fill colour is taken from the implicit `DrawingContext`

.

borderedPath :: Num u => PrimPath u -> Graphic uSource

`borderedPath`

: ` path -> Graphic `

This is the analogue to `fillStroke`

in `Wumpus-core`

, but the
drawing properties (fill colour, border colour, line width,
etc.) are taken from the implicit `DrawingContext`

.

rtextline :: Num u => String -> LocThetaGraphic uSource

This is the analogue to `rtextlabel`

in `Wumpus-core`

.

escapedline :: Num u => EscapedText -> LocGraphic uSource

This is the analogue to `escapedlabel`

in `Wumpus-core`

.

rescapedline :: Num u => EscapedText -> LocThetaGraphic uSource

This is the analogue to `rescapedlabel`

in `Wumpus-core`

.

hkernline :: Num u => [KerningChar u] -> LocGraphic uSource

This is the analogue to `hkernlabel`

in `Wumpus-core`

.

vkernline :: Num u => [KerningChar u] -> LocGraphic uSource

This is the analogue to `vkernlabel`

in `Wumpus-core`

.

strokedEllipse :: Num u => u -> u -> LocGraphic uSource

This is the analogue to `strokeEllipse`

in `Wumpus-core`

.

rstrokedEllipse :: Num u => u -> u -> LocThetaGraphic uSource

This is the analogue to `rstrokeEllispe`

in `Wumpus-core`

.

filledEllipse :: Num u => u -> u -> LocGraphic uSource

This is the analogue to `fillEllispe`

in `Wumpus-core`

.

rfilledEllipse :: Num u => u -> u -> LocThetaGraphic uSource

This is the analogue to `rfillEllispe`

in `Wumpus-core`

.

borderedEllipse :: Num u => u -> u -> LocGraphic uSource

This is the analogue to `fillStrokeEllispe`

in `Wumpus-core`

.

rborderedEllipse :: Num u => u -> u -> LocThetaGraphic uSource

This is the analogue to `rfillStrokeEllispe`

in `Wumpus-core`

.

straightLine :: Fractional u => Vec2 u -> LocGraphic uSource

Draw a straight line formed from displacing the implicit start point with the supplied vector.

straightLineBetween :: Fractional u => Point2 u -> Point2 u -> Graphic uSource

Draw a straight line - start and end point are supplied explicitly.

curveBetween :: Fractional u => Point2 u -> Point2 u -> Point2 u -> Point2 u -> Graphic uSource

Draw a Bezier curve - all points are supplied explicitly.

strokedRectangle :: Fractional u => u -> u -> LocGraphic uSource

Supplied point is *bottom left*.

filledRectangle :: Fractional u => u -> u -> LocGraphic uSource

Supplied point is *bottom left*.

borderedRectangle :: Fractional u => u -> u -> LocGraphic uSource

Supplied point is *bottom left*.

strokedCircle :: Floating u => Int -> u -> LocGraphic uSource

Supplied point is center. Circle is drawn with Bezier curves.

filledCircle :: Floating u => Int -> u -> LocGraphic uSource

Supplied point is center. Circle is drawn with Bezier curves.

borderedCircle :: Floating u => Int -> u -> LocGraphic uSource

Supplied point is center. Circle is drawn with Bezier curves.

strokedDisk :: Num u => u -> LocGraphic uSource

`disk`

is drawn with Wumpus-Core's `ellipse`

primitive.

This is a efficient representation of circles using
PostScript's `arc`

or SVG's `circle`

in the generated
output. However, stroked-circles do not draw well after
non-uniform scaling - the line width is scaled as well as
the shape.

For stroked circles that can be adequately scaled, use
`strokedCircle`

instead.

filledDisk :: Num u => u -> LocGraphic uSource

Filled disk...

borderedDisk :: Num u => u -> LocGraphic uSource

bordered disk...