Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | stephen.tetley@gmail.com |
Refined instances of of the Drawing type modelling specific graphic types.
** WARNING ** - some names are expected to change.
- type PointDisplace u = Point2 u -> Point2 u
- type AdvanceVec u = Vec2 u
- type DrawingInfo a = CF a
- type LocDrawingInfo u a = LocCF u a
- type LocThetaDrawingInfo u a = LocThetaCF u a
- type Graphic u = CF (PrimGraphic u)
- type LocGraphic u = LocCF u (PrimGraphic u)
- type LocThetaGraphic u = LocThetaCF u (PrimGraphic u)
- type ConnectorGraphic u = ConnectorCF u (PrimGraphic u)
- type DGraphic = Graphic Double
- type DLocGraphic = LocGraphic Double
- type DLocThetaGraphic = LocThetaGraphic Double
- type DConnectorGraphic = ConnectorGraphic Double
- type Image u a = CF (a, PrimGraphic u)
- type LocImage u a = LocCF u (a, PrimGraphic u)
- type LocThetaImage u a = LocThetaCF u (a, PrimGraphic u)
- type ConnectorImage u a = ConnectorCF u (a, PrimGraphic u)
- type DImage a = Image Double a
- type DLocImage a = LocImage Double a
- type DLocThetaImage a = LocThetaImage Double a
- type DConnectorImage a = ConnectorImage Double a
- type AdvGraphic u = LocImage u (Point2 u)
- type DAdvGraphic = AdvGraphic Double
- type BoundedGraphic u = Image u (BoundingBox u)
- type DBoundedGraphic = BoundedGraphic Double
- type BoundedLocGraphic u = LocImage u (BoundingBox u)
- type DBoundedLocGraphic = BoundedLocGraphic Double
- advanceH :: Num u => AdvanceVec u -> u
- advanceV :: Num u => AdvanceVec u -> u
- runGraphic :: DrawingContext -> Graphic u -> PrimGraphic u
- runLocGraphic :: DrawingContext -> Point2 u -> LocGraphic u -> PrimGraphic u
- runImage :: DrawingContext -> Image u a -> (a, PrimGraphic u)
- runLocImage :: DrawingContext -> Point2 u -> LocImage u a -> (a, PrimGraphic u)
- moveLoc :: (Point2 u -> Point2 u) -> LocCF u a -> LocCF u a
- at :: CF (Point2 u -> b) -> Point2 u -> CF b
- extrGraphic :: Image u a -> Graphic u
- extrLocGraphic :: LocImage u a -> LocGraphic u
- fontDeltaGraphic :: Graphic u -> Graphic u
- fontDeltaImage :: Image u a -> Image u a
- xlinkGraphic :: XLink -> Graphic u -> Graphic u
- xlinkImage :: XLink -> Image u a -> Image u a
- intoImage :: CF a -> Graphic u -> Image u a
- intoLocImage :: LocCF u a -> LocGraphic u -> LocImage u a
- intoConnectorImage :: ConnectorCF u a -> ConnectorGraphic u -> ConnectorImage u a
- intoLocThetaImage :: LocThetaCF u a -> LocThetaGraphic u -> LocThetaImage u a
- makeAdvGraphic :: PointDisplace u -> LocGraphic u -> AdvGraphic u
Function from Point to Point
type PointDisplace u = Point2 u -> Point2 uSource
Advance vector
type AdvanceVec u = Vec2 uSource
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.
type DLocGraphic = LocGraphic DoubleSource
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 LocThetaImage u a = LocThetaCF 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.
type DLocThetaImage a = LocThetaImage Double aSource
type DConnectorImage a = ConnectorImage Double aSource
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.
type DAdvGraphic = AdvGraphic DoubleSource
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
runGraphic :: DrawingContext -> Graphic u -> PrimGraphic uSource
runLocGraphic :: DrawingContext -> Point2 u -> LocGraphic u -> PrimGraphic uSource
runImage :: DrawingContext -> Image u a -> (a, PrimGraphic u)Source
runLocImage :: DrawingContext -> Point2 u -> LocImage u a -> (a, PrimGraphic u)Source
Combinators
Dropping answers
extrGraphic :: Image u a -> Graphic uSource
extrLocGraphic :: LocImage u a -> LocGraphic uSource
fontDeltaGraphic :: Graphic u -> Graphic uSource
fontDeltaImage :: Image u a -> Image u aSource
xlinkGraphic :: XLink -> Graphic u -> Graphic uSource
xlinkImage :: XLink -> Image u a -> Image u aSource
intoLocImage :: LocCF u a -> LocGraphic u -> LocImage u aSource
intoConnectorImage :: ConnectorCF u a -> ConnectorGraphic u -> ConnectorImage u aSource
intoLocThetaImage :: LocThetaCF u a -> LocThetaGraphic u -> LocThetaImage u aSource
makeAdvGraphic :: PointDisplace u -> LocGraphic u -> AdvGraphic uSource
Construction is different to intoZZ functions hence the different name.