| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Imj.Graphics.UI.RectContainer
Contents
- data RectContainer = RectContainer {}
- getSideCentersAtDistance :: RectContainer -> Length Width -> Length Height -> (Coords Pos, Coords Pos, Coords Pos, Coords Pos)
- class Colorable a where
RectContainer
RectContainer represents a rectangular UI container. It
contains the Size of its content, and an upper left coordinate.
Being Colorable, it can be wrapped in a Colored to gain the notion of color.
data RectContainer Source #
r----------------------------+ | u--+ | | |//| | | |//| | | +--l | | | +----------------------------+ r = Terminal origin, at (0,0) / = RectContainer's content, of size (2,2) u = RectContainer's upper left corner, at (2,1) l = RectContainer's lower left corner, at (5,4)
Constructors
| RectContainer | |
Fields
| |
Instances
| Eq RectContainer Source # | |
| Show RectContainer Source # | |
| DiscreteDistance RectContainer Source # | Smoothly transforms the 4 sides of the rectangle simultaneously, from their middle to their extremities. |
| Colorable RectContainer Source # | |
| DiscreteColorableMorphing RectContainer Source # | |
getSideCentersAtDistance Source #
Arguments
| :: RectContainer | Reference container |
| -> Length Width | Horizontal distance |
| -> Length Height | Horizontal distance |
| -> (Coords Pos, Coords Pos, Coords Pos, Coords Pos) | (center Up, center Down, center Left, center Right) |
Returns points centered on the sides of a container which is at a given distances (dx and dy) from the reference container.
- container at a distance from another container
- In this illustration,
cont'is at dx = dy = 3 fromcont:
cont'
+--------+..-
| | | dy = 3
| cont | |
| +--+..|..-
| | | |
| | | |
| +--+ |
| . |
| . |
+--------+
. .
. .
>|--|<
dx = 3
- Favored direction for centers of horizontal sides
- When computing the center of an horizontal side, if the side has an even length,
we must favor a
Direction. (Note that if the side has an odd length, there is no ambiguity.)
In align implementation, Centered alignment
favors the RIGHT Direction:
1 12 123 1234 ^
- If we, too, favor the
RIGHTDirection, when the returned point is used as reference for aCenteredalignment, the text will tend to be too far to theRIGHT, as illustrated here (^indicates the chosen center):
1 +--+ 12 +--+ 123 +--+ 1234 +--+ ^
1 +--+ 12 +--+ 123 +--+ 1234 +--+ ^
Reexports
class Colorable a where Source #
A Colorable is a colourless graphical element.
Minimal complete definition
Methods
drawUsingColor :: (Draw e, MonadReader e m, MonadIO m) => a -> LayeredColor -> m () Source #
To draw a Colorable, we need to pass a LayeredColor.
Instances