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 -> Maybe (Picture u)
- drawGraphicU :: (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
- centermonoTextline :: (Fractional u, Ord u, FromPtSize u) => String -> LocGraphic 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 -> Point2 u -> Point2 u
- displace :: Num u => u -> u -> Point2 u -> Point2 u
- hdisplace :: Num u => u -> Point2 u -> Point2 u
- vdisplace :: Num u => u -> Point2 u -> Point2 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

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

drawGraphicU :: (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

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.

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

Point is the baseline left of the bottom line.

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

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