gloss-juicy 0.1 → 0.1.1
raw patch · 2 files changed
+41/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Graphics.Gloss.Juicy: loadBMP :: FilePath -> IO Picture
+ Graphics.Gloss.Juicy: loadJuicy :: FilePath -> IO (Maybe Picture)
+ Graphics.Gloss.Juicy: loadJuicyJPG :: FilePath -> IO (Maybe Picture)
+ Graphics.Gloss.Juicy: loadJuicyPNG :: FilePath -> IO (Maybe Picture)
Files
- Graphics/Gloss/Juicy.hs +40/−7
- gloss-juicy.cabal +1/−1
Graphics/Gloss/Juicy.hs view
@@ -1,10 +1,21 @@-module Graphics.Gloss.Juicy ( fromDynamicImage- , fromImageRGBA8- , fromImageRGB8- , fromImageY8- , fromImageYA8- , fromImageYCbCr8- ) +module Graphics.Gloss.Juicy+ (+ -- * Conversion from JuicyPixels' types to gloss' Picture+ fromDynamicImage+ , fromImageRGBA8+ , fromImageRGB8+ , fromImageY8+ , fromImageYA8+ , fromImageYCbCr8++ -- * Loading a gloss Picture from a file through JuicyPixels+ , loadJuicy+ , loadJuicyJPG+ , loadJuicyPNG++ -- * From gloss, exported here for convenience+ , loadBMP+ ) where import Codec.Picture@@ -60,3 +71,25 @@ fromImageYCbCr8 :: Image PixelYCbCr8 -> Picture fromImageYCbCr8 = fromImageRGB8 . convertImage {-# INLINE fromImageYCbCr8 #-}++-- | Tries to load an image file into a Picture using 'readImage' from JuicyPixels.+-- It means it'll try to successively read the content as an image in the following order,+-- until it succeeds (or fails on all of them): jpeg, png, bmp, gif, hdr (the last two are not supported)+-- This is handy when you don't know what format the image contained in the file is encoded with.+-- If you know the format in advance, use 'loadBMP', 'loadJuicyJPG' or 'loadJuicyPNG'+loadJuicy :: FilePath -> IO (Maybe Picture)+loadJuicy = loadWith readImage+{-# INLINE loadJuicy #-}++loadJuicyJPG :: FilePath -> IO (Maybe Picture)+loadJuicyJPG = loadWith readJpeg+{-# INLINE loadJuicyJPG #-}++loadJuicyPNG :: FilePath -> IO (Maybe Picture)+loadJuicyPNG = loadWith readPng+{-# INLINE loadJuicyPNG #-}++loadWith :: (FilePath -> IO (Either String DynamicImage)) -> FilePath -> IO (Maybe Picture)+loadWith reader fp = do+ eImg <- reader fp+ return $ either (const Nothing) fromDynamicImage eImg
gloss-juicy.cabal view
@@ -1,5 +1,5 @@ name: gloss-juicy-version: 0.1+version: 0.1.1 synopsis: Load any image supported by Juicy.Pixels in your gloss application description: Lets you convert any image supported by Juicy.Pixels in a gloss application by converting to gloss' Bitmap representation. homepage: http://github.com/alpmestan/gloss-juicy