wumpus-basic-0.3.0: Common drawing utilities built on wumpus-core.Source codeContentsIndex
Wumpus.Deprecated.PictureLanguage
PortabilityGHC with TypeFamilies and more
Stabilityunstable
Maintainerstephen.tetley@gmail.com
Contents
Data types for alignment
Type family and classes
Bounds
Composition
Compose with alignment
Special function for text
Description

Type classes and derived functions to compose 2D pictures.

WARNING - this module is deprecated.

Synopsis
data HAlign
= HTop
| HCenter
| HBottom
data VAlign
= VLeft
| VCenter
| VRight
type family PUnit a
class Horizontal a where
moveH :: PUnit a -> a -> a
leftBound :: a -> PUnit a
rightBound :: a -> PUnit a
class Vertical a where
moveV :: PUnit a -> a -> a
topBound :: a -> PUnit a
bottomBound :: a -> PUnit a
class Composite a where
over :: a -> a -> a
beneath :: a -> a -> a
class Move a where
move :: PUnit a -> PUnit a -> a -> a
class Blank a where
blank :: PUnit a -> PUnit a -> a
center :: (Horizontal a, Vertical a, Fractional u, u ~ PUnit a) => a -> Point2 u
topleft :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 u
topright :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 u
bottomleft :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 u
bottomright :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 u
(-@-) :: (Horizontal a, Vertical a, Composite a, Move a, Fractional u, u ~ PUnit a) => a -> a -> a
(->-) :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> a -> a
(-<-) :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> a -> a
(-//-) :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> a
above :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> a
below :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> a
at :: (Move a, u ~ PUnit a) => a -> Point2 u -> a
centeredAt :: (Horizontal a, Vertical a, Move a, Composite a, Blank a, Fractional u, u ~ PUnit a) => a -> Point2 u -> a
stackOnto :: Composite a => [a] -> a -> a
hcat :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> [a] -> a
vcat :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> [a] -> a
stackOntoCenter :: (Horizontal a, Vertical a, Composite a, Move a, Fractional u, u ~ PUnit a) => [a] -> a -> a
hspace :: (Num u, Composite a, Horizontal a, Blank a, u ~ PUnit a) => u -> a -> a -> a
vspace :: (Num u, Composite a, Vertical a, Blank a, u ~ PUnit a) => u -> a -> a -> a
hsep :: (Num u, Composite a, Horizontal a, Blank a, u ~ PUnit a) => u -> a -> [a] -> a
vsep :: (Num u, Composite a, Vertical a, Blank a, u ~ PUnit a) => u -> a -> [a] -> a
alignH :: (Fractional u, Composite a, Horizontal a, Vertical a, Move a, u ~ PUnit a) => HAlign -> a -> a -> a
alignV :: (Fractional u, Composite a, Horizontal a, Vertical a, Move a, u ~ PUnit a) => VAlign -> a -> a -> a
hcatA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, u ~ PUnit a) => HAlign -> a -> [a] -> a
vcatA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, u ~ PUnit a) => VAlign -> a -> [a] -> a
hsepA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, Blank a, u ~ PUnit a) => HAlign -> u -> a -> [a] -> a
vsepA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, Blank a, u ~ PUnit a) => VAlign -> u -> a -> [a] -> a
multilabel :: (Real u, Floating u, TextLabel t) => t -> u -> VAlign -> [String] -> Point2 u -> Picture u
Data types for alignment
data HAlign Source
Horizontal alignment - align to the top, center or bottom.
Constructors
HTop
HCenter
HBottom
show/hide Instances
data VAlign Source
Vertical alignment - align to the left, center or bottom.
Constructors
VLeft
VCenter
VRight
show/hide Instances
Type family and classes
type family PUnit a Source
The type of points within a Picture.
class Horizontal a whereSource
Move horizontally.
Methods
moveH :: PUnit a -> a -> aSource
leftBound :: a -> PUnit aSource
rightBound :: a -> PUnit aSource
show/hide Instances
(Num u, Ord u) => Horizontal (Picture u)
class Vertical a whereSource
Move vertically.
Methods
moveV :: PUnit a -> a -> aSource
topBound :: a -> PUnit aSource
bottomBound :: a -> PUnit aSource
show/hide Instances
(Num u, Ord u) => Vertical (Picture u)
class Composite a whereSource
 a `over` b

Place 'picture' a over b. The idea of over here is the same as z-ordering in 2D design programs. Implementations of this class should 'draw' picture a over b but move neither.

Similarly beneath should 'draw' the first picture behind the second but move neither.

Beneath has a default definition:

 beneath = flip over
Methods
over :: a -> a -> aSource
beneath :: a -> a -> aSource
show/hide Instances
(Num u, Ord u) => Composite (Picture u)
class Move a whereSource
Move in both the horizontal and vertical.
Methods
move :: PUnit a -> PUnit a -> a -> aSource
show/hide Instances
(Num u, Ord u) => Move (Picture u)
class Blank a whereSource
Create a picture that has no content but occupies space (i.e. it has a bounding box).
Methods
blank :: PUnit a -> PUnit a -> aSource
show/hide Instances
(Num u, Ord u) => Blank (Picture u)
Bounds
Corresponding operations are available on bounding boxes - the definitions here have different type class obligations.
center :: (Horizontal a, Vertical a, Fractional u, u ~ PUnit a) => a -> Point2 uSource
The center of a picture.
topleft :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 uSource
Extract the top-left corner.
topright :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 uSource
Extract the top-right corner.
bottomleft :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 uSource
Extract the bottom-left corner.
bottomright :: (Horizontal a, Vertical a, u ~ PUnit a) => a -> Point2 uSource
Extract the bottom-right corner.
Composition
(-@-) :: (Horizontal a, Vertical a, Composite a, Move a, Fractional u, u ~ PUnit a) => a -> a -> aSource
 a -@- b

Center a on top of b, a is potentially moved and drawn over b.

(->-) :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> a -> aSource
 a ->- b

Horizontal composition - move b, placing it to the right of a.

(-<-) :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> a -> aSource
 a -<- b

Horizontal composition - move a, placing it to the left of b.

(-//-) :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> aSource
 a -//- b

Vertical composition - move b, placing it below a.

above :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> aSource
 a `above` b

Vertical composition - move a, placing it above b.

below :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> a -> aSource
 a `below` b

Vertical composition - move a, placing it below b

at :: (Move a, u ~ PUnit a) => a -> Point2 u -> aSource
Place the picture at the supplied point.
centeredAt :: (Horizontal a, Vertical a, Move a, Composite a, Blank a, Fractional u, u ~ PUnit a) => a -> Point2 u -> aSource
Center the picture at the supplied point.
stackOnto :: Composite a => [a] -> a -> aSource
 xs `stackOnto` a

Stack the list of pictures xs over a.

Note, the first picture in the list is drawn at the top, the last picture is draw over a.

hcat :: (Horizontal a, Composite a, Num u, u ~ PUnit a) => a -> [a] -> aSource
 x ->- xs

Concatenate the list pictures xs horizontally with (->-) starting at x.

vcat :: (Vertical a, Composite a, Num u, u ~ PUnit a) => a -> [a] -> aSource
 x -//- xs

Concatenate the list of pictures xs vertically with (-//-) starting at x.

stackOntoCenter :: (Horizontal a, Vertical a, Composite a, Move a, Fractional u, u ~ PUnit a) => [a] -> a -> aSource
Stack pictures centered ontop of each other - the first picture in the list is drawn at the top, last picture is on drawn at the bottom.
hspace :: (Num u, Composite a, Horizontal a, Blank a, u ~ PUnit a) => u -> a -> a -> aSource
 hspace n a b

Concatenate the pictures a and b with (->-) - injecting a space of n units to separate the pictures.

vspace :: (Num u, Composite a, Vertical a, Blank a, u ~ PUnit a) => u -> a -> a -> aSource
 vspace n a b

Concatenate the pictures a and b with (-//-) - injecting a space of n units to separate the pictures.

hsep :: (Num u, Composite a, Horizontal a, Blank a, u ~ PUnit a) => u -> a -> [a] -> aSource
 hsep n x xs

Concatenate the list of pictures xs horizontally with hspace starting at x. The pictures are interspersed with spaces of n units.

vsep :: (Num u, Composite a, Vertical a, Blank a, u ~ PUnit a) => u -> a -> [a] -> aSource
 vsep n x 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, Composite a, Horizontal a, Vertical a, Move a, u ~ PUnit a) => HAlign -> a -> a -> aSource
 alignH z a b

Move picture b up or down to be horizontally aligned along a line from the top, center or bottom of picture a

alignV :: (Fractional u, Composite a, Horizontal a, Vertical a, Move a, u ~ PUnit a) => VAlign -> a -> a -> aSource
 alignV z a b

Move picture b left or right to be vertically aligned along a line from the left side, center or right side of picture a

hcatA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, u ~ PUnit a) => HAlign -> a -> [a] -> aSource
Variant of hcat that aligns the pictures as well as concatenating them.
vcatA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, u ~ PUnit a) => VAlign -> a -> [a] -> aSource
Variant of vcat that aligns the pictures as well as concatenating them.
hsepA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, Blank a, u ~ PUnit a) => HAlign -> u -> a -> [a] -> aSource
Variant of hsep that aligns the pictures as well as concatenating and spacing them.
vsepA :: (Fractional u, Horizontal a, Vertical a, Composite a, Move a, Blank a, u ~ PUnit a) => VAlign -> u -> a -> [a] -> aSource
Variant of vsep that aligns the pictures as well as concatenating and spacing them.
Special function for text
multilabel :: (Real u, Floating u, TextLabel t) => t -> u -> VAlign -> [String] -> Point2 u -> Picture uSource

Create multiple lines of text.

The dimension argument is the linespacing, measured as the distance between the upper lines descender and the lower lines ascender.

An error is throw if the list of strings is empty

Produced by Haddock version 2.6.1