wumpus-basic-0.13.0: Common drawing utilities built on wumpus-core.

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Graphic.GraphicTypes

Contents

Description

Refined instances of of the Drawing type modelling specific graphic types.

** WARNING ** - some names are expected to change.

Synopsis

Function from Point to Point

Advance vector

Drawing info

type DrawingInfo a = CF aSource

A query on the DrawingContext.

Alias for CF.

type LocDrawingInfo u a = LocCF u aSource

A query on the DrawingContext respective to the supplied point.

Alias for LocCF.

type LocThetaDrawingInfo u a = LocThetaCF u aSource

A query on the DrawingContext respective to the supplied point and angle.

Alias for LocCF.

Graphic

type Graphic u = CF (PrimGraphic u)Source

Simple drawing - produce a primitive, access the DrawingContext if required.

type LocGraphic u = LocCF u (PrimGraphic u)Source

Commonly graphics take a start point as well as a drawing context.

Here they are called a LocGraphic - graphic with a (starting) location.

type LocThetaGraphic u = LocThetaCF u (PrimGraphic u)Source

A function from point * angle -> graphic

type ConnectorGraphic u = ConnectorCF u (PrimGraphic u)Source

ConnectorGraphic is a connector drawn between two points contructing a Graphic.

Image

type Image u a = CF (a, PrimGraphic u)Source

Images return a value as well as drawing. A node is a typical example - nodes are drawing but the also support taking anchor points.

type LocImage u a = LocCF u (a, PrimGraphic u)Source

type ConnectorImage u a = ConnectorCF u (a, PrimGraphic u)Source

ConnectorImage is a connector drawn between two points constructing an Image.

Usually the answer type of a ConnectorImage will be a Path so the Points ar midway, atstart etc. can be taken on it.

Advance vector graphic

type AdvGraphic u = LocImage u (Point2 u)Source

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

Bounded graphic / loc graphic

type BoundedGraphic u = Image u (BoundingBox u)Source

Graphic with a bounding box.

type BoundedLocGraphic u = LocImage u (BoundingBox u)Source

LocGraphic with a bounding box.

Extract from an Advance vector

advanceH :: Num u => 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, e.g. when calculating bounding boxes for left-to-right text.

advanceV :: Num u => AdvanceVec u -> uSource

Extract the verticaltal component of an advance vector.

For left-to-right latin text, the vertical component of an advance vector is expected to be 0.

Run functions

Combinators

moveLoc :: (Point2 u -> Point2 u) -> LocCF u a -> LocCF u aSource

at :: CF (Point2 u -> b) -> Point2 u -> CF bSource

Dropping answers

intoImage :: CF a -> Graphic u -> Image u aSource

makeAdvGraphic :: PointDisplace u -> LocGraphic u -> AdvGraphic uSource

Construction is different to intoZZ functions hence the different name.