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
- 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
- localDrawingContext :: (DrawingContext -> DrawingContext) -> LocGraphic u -> LocGraphic u
- localPoint :: (Point2 u -> Point2 u) -> LocGraphic u -> LocGraphic u
- displace :: Num u => u -> u -> Point2 u -> Point2 u
- straightLine :: Fractional u => Vec2 u -> LocGraphic 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

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`

.

localDrawingContext :: (DrawingContext -> DrawingContext) -> LocGraphic u -> LocGraphic uSource

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

straightLine :: Fractional u => Vec2 u -> LocGraphic 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