on master help sign in
Up version to 4.7.0.0. Tweak documentation.
commit71cd98f595fb39816d6fe4f70d81ef312d5d6098 authorCorey O'Connor <coreyoconnor@gmail.com> dateTue 24 May 2011, 18:07 (15 years ago) parentde65cb2
4 files changed+24−9
CHANGELOG+7 README+3−1 src/Graphics/Vty/Image.hs+10−6 vty.cabal+4−2
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+
184.3.0.0
29
3104.2.1.0
README+3−1
@@ -40,7 +40,9 @@ Current disadvantages:
4040* Uses the TIOCGWINSZ ioctl to find the current window size, which
4141 appears to be limited to Linux and *BSD.
4242
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
4446
4547To compile the demonstration program: ghc --make test/Test.hs gwinsz.c
4648
src/Graphics/Vty/Image.hs+10−6
@@ -216,9 +216,9 @@ image_width HorizJoin { output_width = w } = w
216216image_width VertJoin { output_width = w } = w
217217image_width BGFill { output_width = w } = w
218218image_width EmptyImage = 0
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
221−image_width ( ImagePad _v i ) = max (image_width i) $ fst _v
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
221+image_width ( ImagePad v i ) = max (image_width i) $ fst v
222222
223223-- | The height of an Image. This is the number of display rows the image will occupy.
224224image_height :: Image -> Word
@@ -227,9 +227,9 @@ image_height HorizJoin { output_height = r } = r
227227image_height VertJoin { output_height = r } = r
228228image_height BGFill { output_height = r } = r
229229image_height EmptyImage = 0
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
232−image_height ( ImagePad _v i ) = max (image_height i) $ snd _v
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
232+image_height ( ImagePad v i ) = max (image_height i) $ snd v
233233
234234-- | Combines two images side by side.
235235--
@@ -343,9 +343,11 @@ char_fill !a !c w h =
343343empty_image :: Image
344344empty_image = EmptyImage
345345
346+-- | Apply the given offset to the image.
346347translate :: (Int, Int) -> Image -> Image
347348translate v i = Translation v i
348349
350+-- | Ensure an image is no larger than the provided size. If the image is larger then crop.
349351crop :: (Word, Word) -> Image -> Image
350352crop (0,_) _ = EmptyImage
351353crop (_,0) _ = EmptyImage
@@ -353,8 +355,10 @@ crop v (ImageCrop _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd
353355crop v (ImagePad _size i) = ImagePad (min (fst v) (fst _size), min (snd v) (snd _size)) i
354356crop v i = ImagePad v i
355357
358+-- | Ensure an image is at least the provided size. If the image is smaler then pad.
356359pad :: (Word, Word) -> Image -> Image
357360pad (0,_) _ = EmptyImage
358361pad (_,0) _ = EmptyImage
359362pad v (ImagePad _size i) = ImagePad (max (fst v) (fst _size), max (snd v) (snd _size)) i
360363pad v i = ImagePad v i
364+
vty.cabal+4−2
@@ -1,5 +1,5 @@
11Name: vty
2−Version: 4.6.0.6
2+Version: 4.7.0.0
33License: BSD3
44License-file: LICENSE
55Author: Stefan O'Rear, Corey O'Connor
@@ -20,7 +20,9 @@ Description:
2020 Notable infelicities: Sometimes poor efficiency; Assumes UTF-8 character encoding support by the
2121 terminal;
2222 .
23− You can 'git' it from <git://github.com/coreyoconnor/vty.git>
23+ Project is hosted on github.com: https://github.com/coreyoconnor/vty
24+ .
25+ git clone git://github.com/coreyoconnor/vty.git
2426 .
2527 &#169; 2006-2007 Stefan O'Rear; BSD3 license.
2628 .