module Data.Bitmap.Reflectable
( BitmapReflectable(..)
) where
import Data.Bitmap.Class
class (Bitmap bmp) => BitmapReflectable bmp where
reflectVertically :: bmp -> bmp
reflectHorizontally :: bmp -> bmp
reflectVertically b = constructPixels f dms
where dms@(_, height) = dimensions b
maxRow = abs . pred $ height
f (r, c) = getPixel b (maxRow r, c)
reflectHorizontally b = constructPixels f dms
where dms@(width, _) = dimensions b
maxColumn = abs . pred $ width
f (r, c) = getPixel b (r, maxColumn c)
instance (Bitmap a) => BitmapReflectable a