Portability | GHC |
---|---|
Stability | unstable |
Maintainer | stephen.tetley@gmail.com |
A Picture-with-implicit-context object.
This is the corresponding type to Picture in the Wumpus-Core.
CtxPicture 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 CtxPicture u
- type DCtxPicture = CtxPicture Double
- runCtxPicture :: DrawingContext -> CtxPicture u -> Maybe (Picture u)
- runCtxPictureU :: DrawingContext -> CtxPicture u -> Picture u
- drawTracing :: (Real u, Floating u, FromPtSize u) => TraceDrawing u a -> CtxPicture u
- clipCtxPicture :: (Num u, Ord u) => PrimPath u -> CtxPicture u -> CtxPicture u
- mapCtxPicture :: (Picture u -> Picture u) -> CtxPicture u -> CtxPicture u
- over :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture u
- under :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture u
- centric :: (Fractional u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture u
- nextToH :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture u
- nextToV :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture u
- atPoint :: (Num u, Ord u) => CtxPicture u -> Point2 u -> CtxPicture u
- centeredAt :: (Fractional u, Ord u) => CtxPicture u -> Point2 u -> CtxPicture u
- zconcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture u
- hcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture u
- vcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture u
- hspace :: (Num u, Ord u) => u -> CtxPicture u -> CtxPicture u -> CtxPicture u
- vspace :: (Num u, Ord u) => u -> CtxPicture u -> CtxPicture u -> CtxPicture u
- hsep :: (Real u, Floating u, FromPtSize u) => u -> [CtxPicture u] -> CtxPicture u
- vsep :: (Real u, Floating u, FromPtSize u) => u -> [CtxPicture u] -> CtxPicture u
- alignH :: (Fractional u, Ord u) => HAlign -> CtxPicture u -> CtxPicture u -> CtxPicture u
- alignV :: (Fractional u, Ord u) => VAlign -> CtxPicture u -> CtxPicture u -> CtxPicture u
- alignHSep :: (Fractional u, Ord u) => HAlign -> u -> CtxPicture u -> CtxPicture u -> CtxPicture u
- alignVSep :: (Fractional u, Ord u) => VAlign -> u -> CtxPicture u -> CtxPicture u -> CtxPicture u
- hcatA :: (Real u, Floating u, FromPtSize u) => HAlign -> [CtxPicture u] -> CtxPicture u
- vcatA :: (Real u, Floating u, FromPtSize u) => VAlign -> [CtxPicture u] -> CtxPicture u
- hsepA :: (Real u, Floating u, FromPtSize u) => HAlign -> u -> [CtxPicture u] -> CtxPicture u
- vsepA :: (Real u, Floating u, FromPtSize u) => VAlign -> u -> [CtxPicture u] -> CtxPicture u
Documentation
data CtxPicture u Source
(Real u, Floating u) => Rotate (CtxPicture u) | |
(Real u, Floating u) => RotateAbout (CtxPicture u) | |
(Num u, Ord u) => Scale (CtxPicture u) | |
(Num u, Ord u) => Translate (CtxPicture u) |
type DCtxPicture = CtxPicture DoubleSource
runCtxPicture :: DrawingContext -> CtxPicture u -> Maybe (Picture u)Source
runCtxPictureU :: DrawingContext -> CtxPicture u -> Picture uSource
drawTracing :: (Real u, Floating u, FromPtSize u) => TraceDrawing u a -> CtxPicture uSource
clipCtxPicture :: (Num u, Ord u) => PrimPath u -> CtxPicture u -> CtxPicture uSource
mapCtxPicture :: (Picture u -> Picture u) -> CtxPicture u -> CtxPicture uSource
Composition
over :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture 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) => CtxPicture u -> CtxPicture u -> CtxPicture uSource
a `under` b
Similarly under
draws the first drawing behind
the second but move neither.
centric :: (Fractional u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture 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) => CtxPicture u -> CtxPicture u -> CtxPicture uSource
a `nextToH` b
Horizontal composition - move b
, placing it to the right
of a
.
nextToV :: (Num u, Ord u) => CtxPicture u -> CtxPicture u -> CtxPicture uSource
a `nextToV` b
Vertical composition - move b
, placing it below a
.
atPoint :: (Num u, Ord u) => CtxPicture u -> Point2 u -> CtxPicture uSource
centeredAt :: (Fractional u, Ord u) => CtxPicture u -> Point2 u -> CtxPicture uSource
Center the picture at the supplied point.
zconcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture uSource
Concatenate the list of drawings.
No pictures are moved.
hcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture uSource
Concatenate the list pictures xs
horizontally.
vcat :: (Real u, Floating u, FromPtSize u) => [CtxPicture u] -> CtxPicture uSource
Concatenate the list of pictures xs
vertically.
hspace :: (Num u, Ord u) => u -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> [CtxPicture u] -> CtxPicture 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 -> [CtxPicture u] -> CtxPicture 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 -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> CtxPicture u -> CtxPicture u -> CtxPicture 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 -> [CtxPicture u] -> CtxPicture uSource
Variant of hcat
that aligns the pictures as well as
concatenating them.
vcatA :: (Real u, Floating u, FromPtSize u) => VAlign -> [CtxPicture u] -> CtxPicture uSource
Variant of vcat
that aligns the pictures as well as
concatenating them.
hsepA :: (Real u, Floating u, FromPtSize u) => HAlign -> u -> [CtxPicture u] -> CtxPicture uSource
Variant of hsep
that aligns the pictures as well as
concatenating and spacing them.
vsepA :: (Real u, Floating u, FromPtSize u) => VAlign -> u -> [CtxPicture u] -> CtxPicture uSource
Variant of vsep
that aligns the pictures as well as
concatenating and spacing them.