@@ -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+