vty-4.2.1.0: A simple terminal access library

Graphics.Vty.Picture

Synopsis

Documentation

data Picture Source

The type of images to be displayed using update. Can be constructed directly or using pic_for_image. Which provides an initial instance with reasonable defaults for pic_cursor and pic_background.

pic_for_image :: Image -> PictureSource

Create a picture for display for the given image. The picture will not have a displayed cursor and the background display attribute will be current_attr.

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 Word Word 

data Background Source

Unspecified regions are filled with the picture's background pattern. The background pattern can specify a character and a display attribute. If the display attribute used previously should be used for a background fill then use current_attr for the background attribute. This is the default background display attribute.

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

(tofix) The background character *must* occupy a single column and no more.

Constructors

Background 

data Image Source

An image in VTY defines:

  • properties required to display the image. These are properties that effect the output image but are independent of position
  • A set of position-dependent text and attribute regions. The possible regions are:
  • a point. ( char )
  • a horizontal line of characters with a single attribute. (string, utf8_string, utf8_bytestring )
  • a fill of a single character. (char_fill)
  • a fill of the picture's background. (background_fill)

todo: increase the number of encoded bytestring formats supported.

Instances

Eq Image 
Show Image 
Monoid Image

Currently append in the Monoid instance is equivalent to -. Future versions will just stack the images.

image_width :: Image -> WordSource

The width of an Image. This is the number display columns the image will occupy.

image_height :: Image -> WordSource

The height of an Image. This is the number of display rows the image will occupy.

(<|>) :: Image -> Image -> ImageSource

Combines two images side by side.

The result image will have a width equal to the sum of the two images width. And the height will equal the largest height of the two images. The area not defined in one image due to a height missmatch will be filled with the background pattern.

(<->) :: Image -> Image -> ImageSource

Combines two images vertically. The result image will have a height equal to the sum of the heights of both images. The width will equal the largest width of the two images. The area not defined in one image due to a width missmatch will be filled with the background pattern.

horiz_cat :: [Image] -> ImageSource

Compose any number of images horizontally.

vert_cat :: [Image] -> ImageSource

Compose any number of images vertically.

background_fill :: Word -> Word -> ImageSource

An area of the picture's bacground (See Background) of w columns and h rows.

char :: Attr -> Char -> ImageSource

an image of a single character. This is a standard Haskell 31-bit character assumed to be in the ISO-10646 encoding.

string :: Attr -> String -> ImageSource

Alias for iso_10646_string. Since the usual case is that a literal string like foo is represented internally as a list of ISO 10646 31 bit characters.

Note: Keep in mind that GHC will compile source encoded as UTF-8 but the literal strings, while UTF-8 encoded in the source, will be transcoded to a ISO 10646 31 bit characters runtime representation.

iso_10646_string :: Attr -> String -> ImageSource

A string of characters layed out on a single row with the same display attribute. The string is assumed to be a sequence of ISO-10646 characters.

Note: depending on how the Haskell compiler represents string literals a string literal in a UTF-8 encoded source file, for example, may be represented as a ISO-10646 string. That is, I think, the case with GHC 6.10. This means, for the most part, you don't need to worry about the encoding format when outputting string literals. Just provide the string literal directly to iso_10646_string or string.

utf8_string :: Attr -> [Word8] -> ImageSource

A string of characters layed out on a single row. The string is assumed to be a sequence of UTF-8 characters.

utf8_bytestring :: Attr -> ByteString -> ImageSource

Renders a UTF-8 encoded bytestring.

char_fill :: Enum d => Attr -> Char -> d -> d -> ImageSource

creates a fill of the specified character. The dimensions are in number of characters wide and number of rows high.

Unlike the Background fill character this character can have double column display width.

empty_image :: ImageSource

The empty image. Useful for fold combinators. These occupy no space nor define any display attributes.

The possible display attributes used in constructing an Image.