on master help sign in
Up version to 4.7.0.0. Tweak documentation.
71cd98fCorey O'Connor
CHANGELOG+7
@@ -1,3 +1,10 @@
1+4.7.0.0
2+ * API changes:
3+ * Added Graphics.Vty.Image.crop: Ensure an image is no larger than the specified size.
4+ * Added Graphics.Vty.Image.pad: Ensure an image is no smaller than the specified size.
5+ * Added Graphics.Vty.Image.translate: Offset an image.
6+ * Thanks Ben Boeckel <MathStuf@gmail.com> for these features.
7+
14.3.0.0
84.3.0.0
2
9
34.2.1.0
104.2.1.0
README+3−1
@@ -40,7 +40,9 @@ Current disadvantages:
40* Uses the TIOCGWINSZ ioctl to find the current window size, which
40* Uses the TIOCGWINSZ ioctl to find the current window size, which
41 appears to be limited to Linux and *BSD.
41 appears to be limited to Linux and *BSD.
42
42
43−darcs get --tag=vty-4.0.0.1 http://code.haskell.org/vty/
43+Project is hosted on github.com: https://github.com/coreyoconnor/vty
44+
45+git clone git://github.com/coreyoconnor/vty.git
44
46
45To compile the demonstration program: ghc --make test/Test.hs gwinsz.c
47To compile the demonstration program: ghc --make test/Test.hs gwinsz.c
46
48
src/Graphics/Vty/Image.hs+10−6
@@ -216,9 +216,9 @@ image_width HorizJoin { output_width = w } = w
216image_width VertJoin { output_width = w } = w
216image_width VertJoin { output_width = w } = w
217image_width BGFill { output_width = w } = w
217image_width BGFill { output_width = w } = w
218image_width EmptyImage = 0
218image_width EmptyImage = 0
219−image_width ( Translation _v i ) = toEnum $ max 0 $ (fst _v +) $ fromEnum $ image_width i
219+image_width ( Translation v i ) = toEnum $ max 0 $ (fst v +) $ fromEnum $ image_width i
220−image_width ( ImageCrop _v i ) = min (image_width i) $ fst _v
220+image_width ( ImageCrop v i ) = min (image_width i) $ fst v
221−image_width ( ImagePad _v i ) = max (image_width i) $ fst _v
221+image_width ( ImagePad v i ) = max (image_width i) $ fst v
222
222
223-- | The height of an Image. This is the number of display rows the image will occupy.
223-- | The height of an Image. This is the number of display rows the image will occupy.
224image_height :: Image -> Word
224image_height :: Image -> Word
@@ -227,9 +227,9 @@ image_height HorizJoin { output_height = r } = r
227image_height VertJoin { output_height = r } = r
227image_height VertJoin { output_height = r } = r
228image_height BGFill { output_height = r } = r
228image_height BGFill { output_height = r } = r
229image_height EmptyImage = 0
229image_height EmptyImage = 0
230−image_height ( Translation _v i ) = toEnum $ max 0 $ (snd _v +) $ fromEnum $ image_height i
230+image_height ( Translation v i ) = toEnum $ max 0 $ (snd v +) $ fromEnum $ image_height i
231−image_height ( ImageCrop _v i ) = min (image_height i) $ snd _v
231+image_height ( ImageCrop v i ) = min (image_height i) $ snd v
232−image_height ( ImagePad _v i ) = max (image_height i) $ snd _v
232+image_height ( ImagePad v i ) = max (image_height i) $ snd v
233
233
234-- | Combines two images side by side.
234-- | Combines two images side by side.
235--
235--
@@ -343,9 +343,11 @@ char_fill !a !c w h =
343empty_image :: Image
343empty_image :: Image
344empty_image = EmptyImage
344empty_image = EmptyImage
345
345
346+-- | Apply the given offset to the image.
346translate :: (Int, Int) -> Image -> Image
347translate :: (Int, Int) -> Image -> Image
347translate v i = Translation v i
348translate v i = Translation v i
348
349
350+-- | Ensure an image is no larger than the provided size. If the image is larger then crop.
349crop :: (Word, Word) -> Image -> Image
351crop :: (Word, Word) -> Image -> Image
350crop (0,_) _ = EmptyImage
352crop (0,_) _ = EmptyImage
351crop (_,0) _ = EmptyImage
353crop (_,0) _ = EmptyImage
@@ -353,8 +355,10 @@ crop v (ImageCrop _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd
353crop v (ImagePad _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd _size)) i
355crop v (ImagePad _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd _size)) i
354crop v i = ImagePad v i
356crop v i = ImagePad v i
355
357
358+-- | Ensure an image is at least the provided size. If the image is smaler then pad.
356pad :: (Word, Word) -> Image -> Image
359pad :: (Word, Word) -> Image -> Image
357pad (0,_) _ = EmptyImage
360pad (0,_) _ = EmptyImage
358pad (_,0) _ = EmptyImage
361pad (_,0) _ = EmptyImage
359pad v (ImagePad _size i) = ImagePad (max (fst v) (fst _size), max (snd v) (snd _size)) i
362pad v (ImagePad _size i) = ImagePad (max (fst v) (fst _size), max (snd v) (snd _size)) i
360pad v i = ImagePad v i
363pad v i = ImagePad v i
364+
vty.cabal+4−2
@@ -1,5 +1,5 @@
1Name: vty
1Name: vty
2−Version: 4.6.0.6
2+Version: 4.7.0.0
3License: BSD3
3License: BSD3
4License-file: LICENSE
4License-file: LICENSE
5Author: Stefan O'Rear, Corey O'Connor
5Author: Stefan O'Rear, Corey O'Connor
@@ -20,7 +20,9 @@ Description:
20 Notable infelicities: Sometimes poor efficiency; Assumes UTF-8 character encoding support by the
20 Notable infelicities: Sometimes poor efficiency; Assumes UTF-8 character encoding support by the
21 terminal;
21 terminal;
22 .
22 .
23+ Project is hosted on github.com: https://github.com/coreyoconnor/vty
24+ .
23− You can 'git' it from <git://github.com/coreyoconnor/vty.git>
25+ git clone git://github.com/coreyoconnor/vty.git
24 .
26 .
25 &#169; 2006-2007 Stefan O'Rear; BSD3 license.
27 &#169; 2006-2007 Stefan O'Rear; BSD3 license.
26 .
28 .