on master help sign in
fixup the documentation of the Picture module
commitbdc4be9b9df5353064b099674bd686c8def7d752 authorCorey O'Connor <corey@ooyala.com> dateFri 20 Dec 2013, 11:12 (13 years ago) parent41c42df
2 files changed+11−13
src/Graphics/Vty/Image.hs+2−2 src/Graphics/Vty/Picture.hs+9−11
src/Graphics/Vty/Image.hs+2−2
@@ -255,8 +255,8 @@ pad in_l in_t in_r in_b in_image
255255
256256-- | translates an image by padding or cropping the top and left.
257257--
258−-- TODO: This has an unexpected effect - Translating an image off the screen and then back onto the
259−-- screen will result in an empty image.
258+-- This can have an unexpected effect: Translating an image to less than (0,0) then to greater than
259+-- (0,0) will crop the image.
260260translate :: Int -> Int -> Image -> Image
261261translate x y i = translate_x x (translate_y y i)
262262
src/Graphics/Vty/Picture.hs+9−11
@@ -1,9 +1,7 @@
11{-# LANGUAGE BangPatterns #-}
2−-- | The Picture data structure is representative of the final terminal view.
2+-- | The 'Picture' data structure is representative of the final terminal view.
33--
4−-- This module re-exports most of the Graphics.Vty.Image and Graphics.Vty.Attributes modules.
5−--
6−-- Copyright 2009-2010 Corey O'Connor
4+-- A 'Picture' is a background paired with a layer of 'Image's.
75module Graphics.Vty.Picture ( module Graphics.Vty.Picture
86 , module Graphics.Vty.Image
97 )
@@ -42,7 +40,7 @@ add_to_bottom :: Picture -> Image -> Picture
4240add_to_bottom p i = p {pic_layers = pic_layers p ++ [i]}
4341
4442-- | Create a picture for display for the given image. The picture will not have a displayed cursor
45−-- and the background display attribute will be `current_attr`.
43+-- and no background pattern (ClearBackground) will be used.
4644pic_for_image :: Image -> Picture
4745pic_for_image i = Picture
4846 { pic_cursor = NoCursor
@@ -51,6 +49,9 @@ pic_for_image i = Picture
5149 }
5250
5351-- | Create a picture for display with the given layers. Ordered top to bottom.
52+--
53+-- The picture will not have a displayed cursor and no background apttern (ClearBackgroun) will be
54+-- used.
5455--
5556-- The first 'Image' is the top layer.
5657pic_for_layers :: [Image] -> Picture
@@ -79,8 +80,7 @@ instance NFData Cursor where
7980-- | A 'Picture' has a background pattern. The background is either ClearBackground. Which shows the
8081-- layer below or is blank if the bottom layer. Or the background pattern is a character and a
8182-- display attribute. If the display attribute used previously should be used for a background fill
82−-- then use `current_attr` for the background attribute. This is the default background display
83−-- attribute.
83+-- then use `current_attr` for the background attribute.
8484--
8585-- \todo The current attribute is always set to the default attributes at the start of updating the
8686-- screen to a picture.
@@ -89,13 +89,11 @@ data Background
8989 { background_char :: Char
9090 , background_attr :: Attr
9191 }
92− -- | The background is:
92+ -- | A ClearBackground is:
9393 --
9494 -- * the space character if there are remaining non-skip ops
95− -- * (?) nothing if there are no remaining non-skip ops.
9695 --
97− -- Might require the terminal interface to do a line clear?
98− -- Or should the nothing case be switched with crlf?
96+ -- * End of line if there are no remaining non-skip ops.
9997 | ClearBackground
10098
10199instance NFData Background where