vty-5.16: A simple terminal UI library

Safe Haskell | None
Language | Haskell2010

Graphics.Vty.Picture

Synopsis

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

# Documentation

data Picture #

A Vty picture.

These can be constructed directly or using `picForImage`.

Constructors

Picture |
Fields picCursor :: Cursor The picture's cursor. picLayers :: [Image] The picture's image layers (top-most first). picBackground :: Background The picture's background to be displayed in locations with no Image data.

Instances

Show Picture # |
Methods showsPrec :: Int -> Picture -> ShowS # show :: Picture -> String # showList :: [Picture] -> ShowS #
NFData Picture # |
Methods rnf :: Picture -> () #

data Cursor #

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

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

Constructors

NoCursor | Hide the cursor
Cursor !Int !Int | Show the cursor at the given logical column accounting for character width in the presence of multi-column characters.
AbsoluteCursor !Int !Int | Show the cursor at the given absolute terminal column and row

Instances

NFData Cursor # |
Methods rnf :: Cursor -> () #

data Background #

A `Picture` has a background pattern. The background is either:

- ClearBackground, which shows the layer below or is blank if the bottom layer
- 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.

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 # |
Methods rnf :: Background -> () #

emptyPicture :: Picture #

A picture with no cursor, background or image layers.

addToTop :: Picture -> Image -> Picture #

Add an `Image` as the top-most layer of a `Picture`.

addToBottom :: Picture -> Image -> Picture #

Add an `Image` as the bottom-most layer of a `Picture`.

picForImage :: Image -> Picture #

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

picForLayers :: [Image] -> Picture #

Create a picture with the given layers, top-most first.

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

picImage :: Picture -> Image #

Return the top-most `Image` layer for a picture. This is unsafe for `Picture`s without at least one layer.

This is provided for compatibility with applications that do not use more than a single layer.