on master help sign in
fixup the documentation of the Picture module
bdc4be9Corey O'Connor
src/Graphics/Vty/Image.hs+2−2
@@ -255,8 +255,8 @@ pad in_l in_t in_r in_b in_image
255
255
256-- | translates an image by padding or cropping the top and left.
256-- | translates an image by padding or cropping the top and left.
257--
257--
258−-- TODO: This has an unexpected effect - Translating an image off the screen and then back onto the
258+-- This can have an unexpected effect: Translating an image to less than (0,0) then to greater than
259−-- screen will result in an empty image.
259+-- (0,0) will crop the image.
260translate :: Int -> Int -> Image -> Image
260translate :: Int -> Int -> Image -> Image
261translate x y i = translate_x x (translate_y y i)
261translate x y i = translate_x x (translate_y y i)
262
262
src/Graphics/Vty/Picture.hs+9−11
@@ -1,9 +1,7 @@
1{-# LANGUAGE BangPatterns #-}
1{-# 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.
3--
3--
4−-- This module re-exports most of the Graphics.Vty.Image and Graphics.Vty.Attributes modules.
4+-- A 'Picture' is a background paired with a layer of 'Image's.
5−--
6−-- Copyright 2009-2010 Corey O'Connor
7module Graphics.Vty.Picture ( module Graphics.Vty.Picture
5module Graphics.Vty.Picture ( module Graphics.Vty.Picture
8 , module Graphics.Vty.Image
6 , module Graphics.Vty.Image
9 )
7 )
@@ -42,7 +40,7 @@ add_to_bottom :: Picture -> Image -> Picture
42add_to_bottom p i = p {pic_layers = pic_layers p ++ [i]}
40add_to_bottom p i = p {pic_layers = pic_layers p ++ [i]}
43
41
44-- | Create a picture for display for the given image. The picture will not have a displayed cursor
42-- | 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.
46pic_for_image :: Image -> Picture
44pic_for_image :: Image -> Picture
47pic_for_image i = Picture
45pic_for_image i = Picture
48 { pic_cursor = NoCursor
46 { pic_cursor = NoCursor
@@ -51,6 +49,9 @@ pic_for_image i = Picture
51 }
49 }
52
50
53-- | Create a picture for display with the given layers. Ordered top to bottom.
51-- | 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.
54--
55--
55-- The first 'Image' is the top layer.
56-- The first 'Image' is the top layer.
56pic_for_layers :: [Image] -> Picture
57pic_for_layers :: [Image] -> Picture
@@ -79,8 +80,7 @@ instance NFData Cursor where
79-- | A 'Picture' has a background pattern. The background is either ClearBackground. Which shows the
80-- | A 'Picture' has a background pattern. The background is either ClearBackground. Which shows the
80-- layer below or is blank if the bottom layer. Or the background pattern is a character and a
81-- layer below or is blank if the bottom layer. Or the background pattern is a character and a
81-- display attribute. If the display attribute used previously should be used for a background fill
82-- 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+-- then use `current_attr` for the background attribute.
83−-- attribute.
84--
84--
85-- \todo The current attribute is always set to the default attributes at the start of updating the
85-- \todo The current attribute is always set to the default attributes at the start of updating the
86-- screen to a picture.
86-- screen to a picture.
@@ -89,13 +89,11 @@ data Background
89 { background_char :: Char
89 { background_char :: Char
90 , background_attr :: Attr
90 , background_attr :: Attr
91 }
91 }
92− -- | The background is:
92+ -- | A ClearBackground is:
93 --
93 --
94 -- * the space character if there are remaining non-skip ops
94 -- * the space character if there are remaining non-skip ops
95− -- * (?) nothing if there are no remaining non-skip ops.
96 --
95 --
97− -- Might require the terminal interface to do a line clear?
96+ -- * End of line if there are no remaining non-skip ops.
98− -- Or should the nothing case be switched with crlf?
99 | ClearBackground
97 | ClearBackground
100
98
101instance NFData Background where
99instance NFData Background where