@@ -14,6 +14,7 @@ import Graphics.Vty.Image
14import Control.DeepSeq
14import Control.DeepSeq
16-- | The type of images to be displayed using 'update'.
16-- | The type of images to be displayed using 'update'.
17-- Can be constructed directly or using `pic_for_image`. Which provides an initial instance with
18-- Can be constructed directly or using `pic_for_image`. Which provides an initial instance with
18-- reasonable defaults for pic_cursor and pic_background.
19-- reasonable defaults for pic_cursor and pic_background.
19data Picture = Picture
20data Picture = Picture
@@ -28,12 +29,15 @@ instance Show Picture where
28instance NFData Picture where
29instance NFData Picture where
29 rnf (Picture c l b) = c `deepseq` l `deepseq` b `deepseq` ()
30 rnf (Picture c l b) = c `deepseq` l `deepseq` b `deepseq` ()
32+-- | a picture with no cursor, background or image layers
31empty_picture :: Picture
33empty_picture :: Picture
32empty_picture = Picture NoCursor [] ClearBackground
34empty_picture = Picture NoCursor [] ClearBackground
36+-- | The given 'Image' is added as the top layer of the 'Picture'
34add_to_top :: Picture -> Image -> Picture
37add_to_top :: Picture -> Image -> Picture
35add_to_top p i = p {pic_layers = i : pic_layers p}
38add_to_top p i = p {pic_layers = i : pic_layers p}
40+-- | The given 'Image' is added as the bottom layer of the 'Picture'
37add_to_bottom :: Picture -> Image -> Picture
41add_to_bottom :: Picture -> Image -> Picture
38add_to_bottom p i = p {pic_layers = pic_layers p ++ [i]}
42add_to_bottom p i = p {pic_layers = pic_layers p ++ [i]}
@@ -48,7 +52,7 @@ pic_for_image i = Picture
49-- | Create a picture for display with the given layers. Ordered top to bottom.
53-- | Create a picture for display with the given layers. Ordered top to bottom.
51−-- The first image is the top layer.
55+-- The first 'Image' is the top layer.
52pic_for_layers :: [Image] -> Picture
56pic_for_layers :: [Image] -> Picture
53pic_for_layers is = Picture
57pic_for_layers is = Picture
54 { pic_cursor = NoCursor
58 { pic_cursor = NoCursor
@@ -72,10 +76,11 @@ instance NFData Cursor where
72 rnf NoCursor = ()
76 rnf NoCursor = ()
73 rnf (Cursor w h) = w `seq` h `seq` ()
77 rnf (Cursor w h) = w `seq` h `seq` ()
75−-- | Unspecified regions are filled with the picture's background pattern. The background pattern
79+-- | 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
76−-- can specify a character and a display attribute. If the display attribute used previously should
81+-- display attribute. If the display attribute used previously should be used for a background fill
77−-- be used for a background fill then use `current_attr` for the background attribute. This is the
82+-- then use `current_attr` for the background attribute. This is the default background display
78−-- default background display attribute.
83+-- attribute.
80-- \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
81-- screen to a picture.
86-- screen to a picture.