wumpus-basic-0.7.0: Common drawing utilities built on wumpus-core.

PortabilityGHC
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.PictureLanguage

Contents

Description

Composition operators for Pictures.

Note - empty pictures cannot exist in Wumpus hence the list functions in this module are always supplied with an initial picture, as well as the (possibly empty) list.

Synopsis

Data types for alignment

data HAlign Source

Horizontal alignment - align to the top, center or bottom.

Constructors

HTop 
HCenter 
HBottom 

Instances

data VAlign Source

Vertical alignment - align to the left, center or bottom.

Constructors

VLeft 
VCenter 
VRight 

Instances

Operations on boundary

centerPoint :: Fractional u => Picture u -> Point2 uSource

The center of a picture.

Composition

over :: (Num u, Ord u) => Picture u -> Picture u -> Picture uSource

 a `over` b

Place 'picture' 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) => Picture u -> Picture u -> Picture uSource

 a `under` b

Similarly under draws the first picture behind the second but move neither.

under was previously beneath.

centerOver :: (Fractional u, Ord u) => Picture u -> Picture u -> Picture uSource

Draw a centered over b - a is moved, b is static.

 a `centerOver` b 

centerOver was previously the (-@-) operator.

nextToH :: (Num u, Ord u) => Picture u -> Picture u -> Picture uSource

 a `nextToH` b

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

nextToH was previously the (->-) operator.

nextToV :: (Num u, Ord u) => Picture u -> Picture u -> Picture uSource

 a `nextToV` b

Vertical composition - move b, placing it below a.

nextToV was previously the (--) operator.

atPoint :: (Num u, Ord u) => Picture u -> Point2 u -> Picture uSource

Place the picture at the supplied point.

atPoint was previous the at operator.

centeredAt :: (Fractional u, Ord u) => Picture u -> Point2 u -> Picture uSource

Center the picture at the supplied point.

stackOver :: (Num u, Ord u) => [Picture u] -> Picture u -> Picture uSource

 xs `stackOver` x

Stack the list of pictures xs over x.

Note, the first picture in the list is drawn at the top, all the pictures in the list are drawn 'over' x. No pictures are moved

 [p1,p2,p3] stackOver p4 => [p1,p2,p3,p4]

zconcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture uSource

 x `zconcat` xs

Concatenate x over the list of pictures xs.

x is drawn at the top. No pictures are moved.

 p1 zconcat [p2,p3,p4] => [p1,p2,p3,p4]

hcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture uSource

Concatenate the list pictures xs horizontally with nextToH starting at x.

vcat :: (Num u, Ord u) => Picture u -> [Picture u] -> Picture uSource

Concatenate the list of pictures xs vertically with nextToV starting at x.

stackOverCenter :: (Fractional u, Ord u) => [Picture u] -> Picture u -> Picture uSource

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, Ord u) => u -> Picture u -> Picture u -> Picture 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 -> Picture u -> Picture u -> Picture uSource

 vspace n a b

Vertical composition - move b, placing it below a with a vertical gap of n separating the pictures.

hsep :: (Num u, Ord u) => u -> Picture u -> [Picture u] -> Picture uSource

 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, Ord u) => u -> Picture u -> [Picture u] -> Picture uSource

 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, Ord u) => HAlign -> Picture u -> Picture u -> Picture 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 -> Picture u -> Picture u -> Picture 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 -> Picture u -> Picture u -> Picture 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 -> Picture u -> Picture u -> Picture uSource

 alignHSep align sep a b

Spacing version of alignV - move b below a separated by sep units, align b according to align.

hcatA :: (Fractional u, Ord u) => HAlign -> Picture u -> [Picture u] -> Picture uSource

Variant of hcat that aligns the pictures as well as concatenating them.

vcatA :: (Fractional u, Ord u) => VAlign -> Picture u -> [Picture u] -> Picture uSource

Variant of vcat that aligns the pictures as well as concatenating them.

hsepA :: (Fractional u, Ord u) => HAlign -> u -> Picture u -> [Picture u] -> Picture uSource

Variant of hsep that aligns the pictures as well as concatenating and spacing them.

vsepA :: (Fractional u, Ord u) => VAlign -> u -> Picture u -> [Picture u] -> Picture uSource

Variant of vsep that aligns the pictures as well as concatenating and spacing them.