gloss-juicy 0.2 → 0.2.2
raw patch · 2 files changed
+18/−26 lines, 2 filesdep ~glossPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: gloss
API changes (from Hackage documentation)
Files
- Graphics/Gloss/Juicy.hs +11/−20
- gloss-juicy.cabal +7/−6
Graphics/Gloss/Juicy.hs view
@@ -2,11 +2,11 @@ ( -- * Conversion from JuicyPixels' types to gloss' Picture fromDynamicImage- , fromImageRGBA8- , fromImageRGB8- , fromImageY8- , fromImageYA8- , fromImageYCbCr8+ , fromImageRGBA8+ , fromImageRGB8+ , fromImageY8+ , fromImageYA8+ , fromImageYCbCr8 -- * Loading a gloss Picture from a file through JuicyPixels , loadJuicy@@ -15,7 +15,7 @@ -- * From gloss, exported here for convenience , loadBMP- )+ ) where import Codec.Picture@@ -35,22 +35,13 @@ fromDynamicImage (ImageRGBF _) = Nothing fromDynamicImage (ImageYF _) = Nothing --- Courtesy of Vincent Berthoux, JuicyPixels' author--- bmp (and thus gloss) starts by the lines at the bottom--- JuicyPixels does the converse-horizontalSwap :: Image PixelRGBA8 -> Image PixelRGBA8-horizontalSwap img@(Image { imageWidth = w, imageHeight = h }) =- generateImage swapper w h- where swapper x y = PixelRGBA8 a b g r- where PixelRGBA8 r g b a = pixelAt img x (h - y - 1)-{-# INLINE horizontalSwap #-}- -- | O(N) conversion from 'PixelRGBA8' image to gloss 'Picture', where N is the number of pixels. fromImageRGBA8 :: Image PixelRGBA8 -> Picture-fromImageRGBA8 img@(Image { imageWidth = w, imageHeight = h, imageData = _ }) =- bitmapOfForeignPtr w h ptr True- where swapedImage = horizontalSwap img- (ptr, _, _) = unsafeToForeignPtr $ imageData swapedImage+fromImageRGBA8 (Image { imageWidth = w, imageHeight = h, imageData = id }) =+ bitmapOfForeignPtr w h+ (BitmapFormat TopToBottom PxRGBA)+ ptr True+ where (ptr, _, _) = unsafeToForeignPtr id {-# INLINE fromImageRGBA8 #-} -- | Creation of a gloss 'Picture' by promoting (through 'promoteImage') the 'PixelRGB8' image to 'PixelRGBA8' and calling 'fromImageRGBA8'.
gloss-juicy.cabal view
@@ -1,5 +1,5 @@ name: gloss-juicy-version: 0.2+version: 0.2.2 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. .@@ -9,28 +9,29 @@ license-file: LICENSE author: Alp Mestanogullari <alpmestan@gmail.com> maintainer: Alp Mestanogullari <alpmestan@gmail.com>-copyright: 2013 Alp Mestanogullari+copyright: 2013-2015 Alp Mestanogullari category: Graphics build-type: Simple cabal-version: >=1.8+tested-with: GHC == 8.0.1 library exposed-modules: Graphics.Gloss.Juicy- + build-depends: base >=4 && < 5, bytestring, bmp >= 1.2.4.1,- gloss >= 1.9,+ gloss >= 1.10, JuicyPixels, vector- ghc-options: -O2 -Wall -threaded+ ghc-options: -O2 -Wall executable gloss-juicy-viewer main-is: gloss-juicy.hs build-depends: base >= 4 && < 5, bytestring, bmp >= 1.2.4.1,- gloss,+ gloss >= 1.10, JuicyPixels, vector ghc-options: -O2 -Wall -threaded