| Portability | GHC |
|---|---|
| Stability | unstable |
| Maintainer | stephen.tetley@gmail.com |
Wumpus.Basic.Kernel.Objects.Drawing
Contents
Description
A Drawing object.
This is the corresponding type to Picture in the Wumpus-Core.
Drawing is a function from the DrawingContext to a Picture. Internally the result is actually a (Maybe Picture) and not a Picture, this is a trick to promote the extraction from possibly empty drawings (created by TraceDrawing) to the top-level of the type hierarchy where client code can deal with empty drawings explicitly (empty Pictures cannot be rendered by Wumpus-Core).
- data Drawing u
- type DDrawing = Drawing Double
- runDrawing :: DrawingContext -> Drawing u -> Maybe (Picture u)
- runDrawingU :: DrawingContext -> Drawing u -> Picture u
- drawTracing :: (Real u, Floating u, FromPtSize u) => TraceDrawing u a -> Drawing u
- clipDrawing :: (Num u, Ord u) => PrimPath u -> Drawing u -> Drawing u
- modifyDrawing :: (Picture u -> Picture u) -> Drawing u -> Drawing u
- over :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing u
- under :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing u
- centric :: (Fractional u, Ord u) => Drawing u -> Drawing u -> Drawing u
- nextToH :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing u
- nextToV :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing u
- atPoint :: (Num u, Ord u) => Drawing u -> Point2 u -> Drawing u
- centeredAt :: (Fractional u, Ord u) => Drawing u -> Point2 u -> Drawing u
- zconcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing u
- hcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing u
- vcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing u
- hspace :: (Num u, Ord u) => u -> Drawing u -> Drawing u -> Drawing u
- vspace :: (Num u, Ord u) => u -> Drawing u -> Drawing u -> Drawing u
- hsep :: (Real u, Floating u, FromPtSize u) => u -> [Drawing u] -> Drawing u
- vsep :: (Real u, Floating u, FromPtSize u) => u -> [Drawing u] -> Drawing u
- alignH :: (Fractional u, Ord u) => HAlign -> Drawing u -> Drawing u -> Drawing u
- alignV :: (Fractional u, Ord u) => VAlign -> Drawing u -> Drawing u -> Drawing u
- alignHSep :: (Fractional u, Ord u) => HAlign -> u -> Drawing u -> Drawing u -> Drawing u
- alignVSep :: (Fractional u, Ord u) => VAlign -> u -> Drawing u -> Drawing u -> Drawing u
- hcatA :: (Real u, Floating u, FromPtSize u) => HAlign -> [Drawing u] -> Drawing u
- vcatA :: (Real u, Floating u, FromPtSize u) => VAlign -> [Drawing u] -> Drawing u
- hsepA :: (Real u, Floating u, FromPtSize u) => HAlign -> u -> [Drawing u] -> Drawing u
- vsepA :: (Real u, Floating u, FromPtSize u) => VAlign -> u -> [Drawing u] -> Drawing u
Documentation
runDrawing :: DrawingContext -> Drawing u -> Maybe (Picture u)Source
runDrawingU :: DrawingContext -> Drawing u -> Picture uSource
drawTracing :: (Real u, Floating u, FromPtSize u) => TraceDrawing u a -> Drawing uSource
Composition
over :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing uSource
a `over` b
Place 'drawing' a over b. The idea of over here is in
terms z-ordering, nither picture a or b are actually moved.
under :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing uSource
a `under` b
Similarly under draws the first drawing behind
the second but move neither.
centric :: (Fractional u, Ord u) => Drawing u -> Drawing u -> Drawing uSource
Draw a, move b so its center is at the same center as
a, b is drawn over underneath in the zorder.
a `centeric` b
nextToH :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing uSource
a `nextToH` b
Horizontal composition - move b, placing it to the right
of a.
nextToV :: (Num u, Ord u) => Drawing u -> Drawing u -> Drawing uSource
a `nextToV` b
Vertical composition - move b, placing it below a.
centeredAt :: (Fractional u, Ord u) => Drawing u -> Point2 u -> Drawing uSource
Center the picture at the supplied point.
zconcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing uSource
Concatenate the list of drawings.
No pictures are moved.
hcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing uSource
Concatenate the list pictures xs horizontally.
vcat :: (Real u, Floating u, FromPtSize u) => [Drawing u] -> Drawing uSource
Concatenate the list of pictures xs vertically.
hspace :: (Num u, Ord u) => u -> Drawing u -> Drawing u -> Drawing uSource
hspace n a b
Horizontal composition - move b, placing it to the right
of a with a horizontal gap of n separating the pictures.
vspace :: (Num u, Ord u) => u -> Drawing u -> Drawing u -> Drawing uSource
vspace n a b
Vertical composition - move b, placing it below a with a
vertical gap of n separating the pictures.
hsep :: (Real u, Floating u, FromPtSize u) => u -> [Drawing u] -> Drawing uSource
hsep n xs
Concatenate the list of pictures xs horizontally with
hspace starting at x. The pictures are interspersed with
spaces of n units.
vsep :: (Real u, Floating u, FromPtSize u) => u -> [Drawing u] -> Drawing uSource
vsep n xs
Concatenate the list of pictures xs vertically with
vspace starting at x. The pictures are interspersed with
spaces of n units.
Compose with alignment
alignH :: (Fractional u, Ord u) => HAlign -> Drawing u -> Drawing u -> Drawing uSource
alignH align a b
Horizontal composition - move b, placing it to the right
of a and align it with the top, center or bottom of a.
alignV :: (Fractional u, Ord u) => VAlign -> Drawing u -> Drawing u -> Drawing uSource
alignV align a b
Vertical composition - move b, placing it below a
and align it with the left, center or right of a.
alignHSep :: (Fractional u, Ord u) => HAlign -> u -> Drawing u -> Drawing u -> Drawing uSource
alignHSep align sep a b
Spacing version of alignH - move b to the right of a
separated by sep units, align b according to align.
alignVSep :: (Fractional u, Ord u) => VAlign -> u -> Drawing u -> Drawing u -> Drawing uSource
alignVSep align sep a b
Spacing version of alignV - move b below a
separated by sep units, align b according to align.
hcatA :: (Real u, Floating u, FromPtSize u) => HAlign -> [Drawing u] -> Drawing uSource
Variant of hcat that aligns the pictures as well as
concatenating them.
vcatA :: (Real u, Floating u, FromPtSize u) => VAlign -> [Drawing u] -> Drawing uSource
Variant of vcat that aligns the pictures as well as
concatenating them.