wumpus-basic-0.16.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Kernel.Objects.PosImage

Contents

Description

Extended Graphic object - a rectangular positionable Image.

This graphic object has a more flexible API for positioning than other graphic objects. Rather than a LocGraphic which supports a single method of positioning at some start-point, a PosGraphic can be drawn at its center or locations on its outer rectangle.

Synopsis

Documentation

data RectPosition Source

Datatype enumerating positions within a rectangle that can be derived for a PosGraphic.

Constructors

CENTER 
NN 
SS 
EE 
WW 
NE 
NW 
SE 
SW 

data ObjectPos u Source

Utility datatype representing orientation within a rectangular frame. ObjectPos is useful for graphics such as text where the start point is not necessarily at the center (or bottom left).

 x_minor is the horizontal distance from the left to the start point

 x_major is the horizontal distance from the start point to the right

 y_minor is the vertical distance from the bottom to the start point

 y_major is the vertical distance from the start point to the top

Values should be not be negative!

Constructors

ObjectPos 

Fields

op_x_minor :: !u
 
op_x_major :: !u
 
op_y_minor :: !u
 
op_y_major :: !u
 

Instances

Eq u => Eq (ObjectPos u) 
Ord u => Ord (ObjectPos u) 
Show u => Show (ObjectPos u) 
(Fractional u, Ord u) => OPlus (ObjectPos u) 

Positionable image

type PosImage u a = CF2 (Point2 u) RectPosition (ImageAns u a)Source

A positionable Image.

type DPosImage a = PosImage Double aSource

Version of PosImage specialized to Double for the unit type.

type PosGraphic u = PosImage u (UNil u)Source

A positionable Graphic.

type DPosGraphic = PosGraphic DoubleSource

Version of PosGraphic specialized to Double for the unit type.

makePosImage :: Fractional u => ObjectPos u -> LocImage u a -> PosImage u aSource

makePosImage : object_pos * loc_graphic -> PosGraphic

Create a PosImage from an ObjectPos describing how it is orientated within a border rectangle and a LocImage that draws it.

startPos :: Floating u => PosImage u a -> RectPosition -> LocImage u aSource

startPos : pos_image * rect_pos -> LocImage

Downcast a PosImage to a LocImage by supplying it with a RectPosition (start position).

atStartPos :: Floating u => PosImage u a -> Point2 u -> RectPosition -> Image u aSource

atStartPos : pos_image * start_point * rect_pos -> LocImage

Downcast a PosGraphic to an Image by supplying it with an initial point and a RectPosition (start position).

objectPosBounds :: Fractional u => Point2 u -> RectPosition -> ObjectPos u -> BoundingBox uSource

Calculate the bounding box formed by locating the ObjectPos at the supplied point.