Safe Haskell | None |
---|
- type DisplayString = Seq (Char, Word)
- data Image
- = HorizText {
- attr :: !Attr
- text :: DisplayString
- output_width :: !Word
- char_width :: !Word
- | HorizJoin {
- part_left :: Image
- part_right :: Image
- output_width :: !Word
- output_height :: !Word
- | VertJoin {
- part_top :: Image
- part_bottom :: Image
- output_width :: !Word
- output_height :: !Word
- | BGFill {
- output_width :: !Word
- output_height :: !Word
- | EmptyImage
- | Translation (Int, Int) Image
- | ImageCrop (Word, Word) Image
- | ImagePad (Word, Word) Image
- = HorizText {
- image_width :: Image -> Word
- image_height :: Image -> Word
- (<|>) :: Image -> Image -> Image
- (<->) :: Image -> Image -> Image
- horiz_cat :: [Image] -> Image
- vert_cat :: [Image] -> Image
- background_fill :: Word -> Word -> Image
- char :: Attr -> Char -> Image
- string :: Attr -> String -> Image
- iso_10646_string :: Attr -> String -> Image
- utf8_string :: Attr -> [Word8] -> Image
- utf8_bytestring :: Attr -> ByteString -> Image
- char_fill :: Enum d => Attr -> Char -> d -> d -> Image
- empty_image :: Image
- translate :: (Int, Int) -> Image -> Image
- safe_wcwidth :: Char -> Word
- safe_wcswidth :: String -> Word
- wcwidth :: Char -> Int
- wcswidth :: String -> Int
- crop :: (Word, Word) -> Image -> Image
- pad :: (Word, Word) -> Image -> Image
- module Graphics.Vty.Attributes
Documentation
type DisplayString = Seq (Char, Word)Source
We pair each character with it's display length. This way we only compute the length once per character. * Though currently the width of some strings is still compute multiple times.
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.
HorizText | |
| |
HorizJoin | |
| |
VertJoin | |
| |
BGFill | |
| |
EmptyImage | |
Translation (Int, Int) Image | |
ImageCrop (Word, Word) Image | |
ImagePad (Word, Word) Image |
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.
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.
The empty image. Useful for fold combinators. These occupy no space nor define any display attributes.
safe_wcwidth :: Char -> WordSource
Returns the display width of a character. Assumes all characters with unknown widths are 1 width
safe_wcswidth :: String -> WordSource
Returns the display width of a string. Assumes all characters with unknown widths are 1 width
crop :: (Word, Word) -> Image -> ImageSource
Ensure an image is no larger than the provided size. If the image is larger then crop.
pad :: (Word, Word) -> Image -> ImageSource
Ensure an image is at least the provided size. If the image is smaller then pad.
The possible display attributes used in constructing an Image
.
module Graphics.Vty.Attributes