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

Stability | highly unstable |

Maintainer | stephen.tetley@gmail.com |

Elementary functions for the Graphic and LocGraphic types.

The functions here are generally analogeous to the Picture
API in `Wumpus.Core`

, but here they exploit the implicit
`DrawingContext`

.

- drawGraphic :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Graphic u -> Picture 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
- centermonoTextline :: (Fractional u, Ord u, FromPtSize u) => String -> LocGraphic u
- escapedline :: Num u => EscapedText -> LocGraphic u
- rescapedline :: Num u => EscapedText -> LocThetaGraphic u
- textlineMulti :: Fractional u => [String] -> LocGraphic u
- hkernline :: Num u => [KerningChar u] -> LocGraphic u
- vkernline :: Num u => [KerningChar u] -> LocGraphic u
- strokedEllipse :: Num u => u -> u -> LocGraphic u
- filledEllipse :: Num u => u -> u -> LocGraphic u
- borderedEllipse :: Num u => u -> u -> LocGraphic u
- supplyPt :: Point2 u -> LocGraphic u -> Graphic u
- localPoint :: (Point2 u -> Point2 u) -> LocGraphic u -> LocGraphic u
- vecdisplace :: Num u => Vec2 u -> PointDisplace u
- displace :: Num u => u -> u -> PointDisplace u
- hdisplace :: Num u => u -> PointDisplace u
- vdisplace :: Num u => u -> PointDisplace u
- parallelvec :: Floating u => u -> Radian -> Vec2 u
- perpendicularvec :: Floating u => u -> Radian -> Vec2 u
- displaceParallel :: Floating u => u -> Radian -> PointDisplace u
- displacePerpendicular :: Floating u => u -> Radian -> PointDisplace 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
- illustrateBoundedGraphic :: Fractional u => BoundedGraphic u -> BoundedGraphic u
- illustrateBoundedLocGraphic :: Fractional u => BoundedLocGraphic u -> BoundedLocGraphic u

# Documentation

drawGraphic :: (Real u, Floating u, FromPtSize u) => DrawingContext -> Graphic u -> Picture uSource

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

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

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

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

textline :: Num u => String -> LocGraphic uSource

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

centermonoTextline :: (Fractional u, Ord u, FromPtSize u) => String -> LocGraphic uSource

As `textline`

but the supplied point is the *center*.

Centered is inexact - it is calculated with monospaced font metrics.

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

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

textlineMulti :: Fractional u => [String] -> LocGraphic uSource

Point is the baseline left of the bottom line, text is left-aligned.

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

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

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

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

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

supplyPt :: Point2 u -> LocGraphic u -> Graphic uSource

Supplying a point to a `CFGraphic`

takes it to a regular
`Graphic`

.

localPoint :: (Point2 u -> Point2 u) -> LocGraphic u -> LocGraphic uSource

vecdisplace :: Num u => Vec2 u -> PointDisplace uSource

displace :: Num u => u -> u -> PointDisplace uSource

hdisplace :: Num u => u -> PointDisplace uSource

vdisplace :: Num u => u -> PointDisplace uSource

parallelvec :: Floating u => u -> Radian -> Vec2 uSource

perpendicularvec :: Floating u => u -> Radian -> Vec2 uSource

displaceParallel :: Floating u => u -> Radian -> PointDisplace uSource

displacePerpendicular :: Floating u => u -> Radian -> PointDisplace uSource

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

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

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

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 scaled, consider making the circle from Bezier curves.

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

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

illustrateBoundedGraphic :: Fractional u => BoundedGraphic u -> BoundedGraphic uSource