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

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Kernel.Objects.PosObject

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

Positionable image

data PosObject u a Source

A positionable "Object".

type DPosObject a = PosObject Double aSource

Version of PosObject specialized to Double for the unit type.

type PosGraphic u = PosObject u (UNil u)Source

Version of PosObject with answer specialized to UNil.

type DPosGraphic = PosGraphic DoubleSource

Version of PosGraphic specialized to Double for the unit type.

Operations

runPosObject :: InterpretUnit u => PosObject u a -> RectAddress -> LocImage u aSource

Running an PosObject produces a LocImage.

runPosObjectBBox :: InterpretUnit u => PosObject u a -> RectAddress -> LocImage u (BoundingBox u)Source

Run a PosObject producing a LocImage (BoundingBox u).

makePosObject :: InterpretUnit u => Query u (Orientation u) -> LocImage u a -> PosObject u aSource

makePosObject : object_pos * loc_image -> PosObject

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

This is the primary constructor for PosObjects. Because the PosObject type is considered as a specialized object it does not have the range of functions of LocImage or LocThetaImage.

emptyPosObject :: (Monoid a, InterpretUnit u) => PosObject u aSource

emptyPosObject : PosObject

Build an empty PosGraphicObject.

extendPosObject :: InterpretUnit u => u -> u -> u -> u -> PosObject u a -> PosObject u aSource

Extend the orientation.

mapOrientation :: InterpretUnit u => (Orientation u -> Orientation u) -> PosObject u a -> PosObject u aSource

Note - this is a bad API, it would be better to have padders and fillers and not expose the orientation directly.

illustratePosObject :: InterpretUnit u => PosObject u a -> LocGraphic uSource

Illustrate a PosObject by super-imposing its Orientation.

This turns the PosObject into a LocImage drawn at the locus of the PosObject.

posChar :: InterpretUnit u => Char -> PosGraphic uSource

Note - no margins are added to the containing rectangle.

To get a Char with margins, use posText instead:

 posText ['1']

posCharPrim :: InterpretUnit u => Either Char EscapedChar -> PosGraphic uSource

Primtive builder that does not add margins.

posTextPrim :: InterpretUnit u => Either String EscapedText -> PosGraphic uSource

Primtive builder that does not add margins.

rposText :: (Real u, Floating u, InterpretUnit u) => Radian -> String -> PosGraphic uSource

Note - for single line text.

rposEscText :: (Real u, Floating u, InterpretUnit u) => Radian -> EscapedText -> PosGraphic uSource

Note - for single line text.

monospaceText :: InterpretUnit u => Query u u -> String -> PosGraphic uSource

The query should retrieve the width of one char.

monospaceEscText :: InterpretUnit u => Query u u -> EscapedText -> PosGraphic uSource

The query should retrieve the width of one char.