vty-5.25.1: 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 Source #

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

Eq Picture Source # |
Instance details Defined in Graphics.Vty.Picture Methods (==) :: Picture -> Picture -> Bool Source # (/=) :: Picture -> Picture -> Bool Source #
Show Picture Source # |
Instance details Defined in Graphics.Vty.Picture Methods showsPrec :: Int -> Picture -> ShowS Source # show :: Picture -> String Source # showList :: [Picture] -> ShowS Source #
NFData Picture Source # |
Instance details Defined in Graphics.Vty.Picture Methods rnf :: Picture -> () Source #

data Cursor Source #

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

Eq Cursor Source # |
Instance details Defined in Graphics.Vty.Picture Methods (==) :: Cursor -> Cursor -> Bool Source # (/=) :: Cursor -> Cursor -> Bool Source #
NFData Cursor Source # |
Instance details Defined in Graphics.Vty.Picture Methods rnf :: 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
- 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

Eq Background Source # |
Instance details Defined in Graphics.Vty.Picture Methods (==) :: Background -> Background -> Bool Source # (/=) :: Background -> Background -> Bool Source #
NFData Background Source # |
Instance details Defined in Graphics.Vty.Picture Methods rnf :: Background -> () Source #

emptyPicture :: Picture Source #

A picture with no cursor, background or image layers.

addToTop :: Picture -> Image -> Picture Source #

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

addToBottom :: Picture -> Image -> Picture Source #

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

picForImage :: Image -> Picture Source #

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 Source #

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 Source #

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.