repa-devil 0.1 → 0.1.1
raw patch · 2 files changed
+6/−2 lines, 2 files
Files
- Data/Array/Repa/IO/DevIL.hs +5/−1
- repa-devil.cabal +1/−1
Data/Array/Repa/IO/DevIL.hs view
@@ -20,7 +20,7 @@ -- -- Example: read a .png file into a 3D repa array, and write it out as a .jpg ----- > main = runIL $+-- > main = runIL $ do -- > x <- readImage "/tmp/y.png" -- > writeImage "/tmp/x.jpg" x --@@ -84,6 +84,7 @@ readImage f = do uarr <- liftIO (D.readImage f) :: IL (UArray (Int, Int, Int) Word8) return $! toRepa uarr+{-# INLINE readImage #-} -- | Writes an RGBA array to a file. Indices are the row, column, and color-channel. --@@ -92,6 +93,7 @@ writeImage :: FilePath -> R.Array DIM3 Word8 -> IL () writeImage f a = do liftIO $ D.writeImage f (fromRepa a)+{-# INLINE writeImage #-} ------------------------------------------------------------------------ @@ -102,6 +104,7 @@ (i,j,k) = (1 + mi - ni, 1 + mj - nj, 1 + mk - nk) es = elems uarr in R.fromList (R.Z :. i :. j :. k) es+{-# INLINE toRepa #-} -- lazily stream a repa array to an unboxed (3d) array fromRepa :: R.Array DIM3 Word8 -> UArray (Int,Int,Int) Word8@@ -109,6 +112,7 @@ let es = R.toList arr (R.Z :. i :. j :. k) = extent arr in listArray ((0,0,0), (i-1, j-1, k-1)) es+{-# INLINE fromRepa #-} {-
repa-devil.cabal view
@@ -1,5 +1,5 @@ Name: repa-devil-Version: 0.1+Version: 0.1.1 Synopsis: Support for image reading and writing of Repa arrays Description: The repa-image library adds support for reading and