module Graphics.Image.Processing (
module Graphics.Image.Processing.Geometric,
module Graphics.Image.Processing.Interpolation,
module Graphics.Image.Processing.Convolution,
Border(..), pixelGrid
) where
#if MIN_VERSION_base(4,8,0)
import Prelude hiding (traverse)
#endif
import Data.Word (Word8)
import Graphics.Image.Interface
import Graphics.Image.Processing.Convolution
import Graphics.Image.Processing.Geometric
import Graphics.Image.Processing.Interpolation
pixelGrid :: (Array arr cs e, Elevator e) =>
Word8
-> Image arr cs e
-> Image arr cs e
pixelGrid !(succ . fromIntegral -> k) !img = traverse img getNewDims getNewPx where
getNewDims !(m, n) = (1 + m*k, 1 + n*k)
getNewPx !getPx !(i, j) = if i `mod` k == 0 || j `mod` k == 0
then fromDouble $ fromChannel 0.5
else getPx ((i 1) `div` k, (j 1) `div` k)