JuicyPixels-repa 0.4 → 0.5
raw patch · 2 files changed
+13/−4 lines, 2 filesdep ~JuicyPixelsdep ~repa
Dependency ranges changed: JuicyPixels, repa
Files
- Codec/Picture/Repa.hs +10/−1
- JuicyPixels-repa.cabal +3/−3
Codec/Picture/Repa.hs view
@@ -11,7 +11,7 @@ -- * Image Representations (Phantom Types) , RGBA, RGB, R, G, B -- * Helper Functions (useful for OpenGL etc.) - , toForeignPtr+ , toForeignPtr, toByteString , onImg , reverseColorChannel , flipHorizontally, flipVertically@@ -31,6 +31,7 @@ import Data.Word import Control.Monad import Data.ByteString as B+import qualified Data.ByteString.Internal as BI import qualified Data.Vector.Unboxed as VU -- |An all-red image@@ -58,6 +59,14 @@ -- All images are held in a three dimensional 'repa' array. If the image -- format is only two dimensional (ex: R, G, or B) then the shape is @Z :. y :. x :. 1@. data Img a = Img { imgData :: Array F DIM3 Word8 }++-- |@toByteString arr@ converts images to bytestrings, which is often useful+-- for Gloss.+toByteString :: Img a -> B.ByteString+toByteString (Img arr) =+ let fp = RF.toForeignPtr arr+ (Z :. row :. col :. chan) = extent arr+ in BI.fromForeignPtr fp 0 (col * row * chan) onImg :: (Array F DIM3 Word8 -> Array F DIM3 Word8) -> Img a -> Img a onImg f (Img a) = Img (f a)
JuicyPixels-repa.cabal view
@@ -1,5 +1,5 @@ Name: JuicyPixels-repa-Version: 0.4+Version: 0.5 Synopsis: Convenience functions to obtain array representations of images. Description: This wraps the Juicy.Pixels library to convert into 'Repa' and 'Data.Vector.Storable' formats.@@ -18,8 +18,8 @@ Library Exposed-modules: Codec.Picture.Repa- Build-depends: base >= 4.0 && < 5, repa >= 3.0 && < 3.3- , JuicyPixels >= 1.1 && < 1.4+ Build-depends: base >= 4.0 && < 5, repa >= 3.2+ , JuicyPixels >= 1.1 && < 2.1 , vector >= 0.9 && < 0.10 , bytestring >= 0.9 && < 0.10 -- Other-modules: