vty-5.4.0: A simple terminal UI library

Safe Haskell | None
Language | Haskell2010

Graphics.Vty.Picture

Description

The `Picture` data structure is representative of the final terminal view.

A `Picture` is a background paired with a layer of `Image`s.

Synopsis

- data Picture = Picture {
  - picCursor :: Cursor
  - picLayers :: [Image]
  - picBackground :: Background
  }
- emptyPicture :: Picture
- addToTop :: Picture -> Image -> Picture
- addToBottom :: Picture -> Image -> Picture
- picForImage :: Image -> Picture
- picForLayers :: [Image] -> Picture
- data Cursor
  - = NoCursor
  - | Cursor Int Int
- data Background
  - = Background {
    - backgroundChar :: Char
    - backgroundAttr :: Attr
    }
  - | ClearBackground
- picImage :: Picture -> Image
- module Graphics.Vty.Image

# Documentation

data Picture Source

The type of images to be displayed using `update`.

Can be constructed directly or using `picForImage`. Which provides an initial instance with reasonable defaults for picCursor and picBackground.

Constructors

Picture |

Fields

picCursor :: Cursor
picLayers :: [Image]
picBackground :: Background

Instances

Show Picture Source |
NFData Picture Source |

emptyPicture :: Picture Source

a picture with no cursor, background or image layers

addToTop :: Picture -> Image -> Picture Source

The given `Image` is added as the top layer of the `Picture`

addToBottom :: Picture -> Image -> Picture Source

The given `Image` is added as the bottom layer of the `Picture`

picForImage :: Image -> Picture Source

Create a picture for display for the given image. The picture will not have a displayed cursor and no background pattern (ClearBackground) will be used.

picForLayers :: [Image] -> Picture Source

Create a picture for display with the given layers. Ordered top to bottom.

The picture will not have a displayed cursor and no background apttern (ClearBackgroun) will be used.

The first `Image` is the top layer.

data Cursor Source

A picture can be configured either to not show the cursor or show the cursor at the specified character position.

There is not a 1 to 1 map from character positions to a row and column on the screen due to characters that take more than 1 column.

todo: The Cursor can be given a (character,row) offset outside of the visible bounds of the output region. In this case the cursor will not be shown.

Constructors

NoCursor |
Cursor Int Int |

Instances

NFData Cursor Source |

data Background Source

A `Picture` has a background pattern. The background is either ClearBackground. Which shows the layer below or is blank if the bottom layer. Or the background pattern is a character and a display attribute. If the display attribute used previously should be used for a background fill then use `currentAttr` for the background attribute.

todo The current attribute is always set to the default attributes at the start of updating the screen to a picture.

Constructors

Background |

Fields

backgroundChar :: Char
backgroundAttr :: Attr

ClearBackground

A ClearBackground is:

- the space character if there are remaining non-skip ops
- End of line if there are no remaining non-skip ops.

Instances

NFData Background Source |

picImage :: Picture -> Image Source

Compatibility with applications that do not use more than a single layer.

module Graphics.Vty.Image