JuicyPixels-extra 0.3.0 → 0.4.0
raw patch · 4 files changed
+36/−17 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Codec.Picture.Extra: scaleBilinear :: (Pixel a, Integral (PixelBaseComponent a)) => Int -> Int -> Image a -> Image a
+ Codec.Picture.Extra: scaleBilinear :: (Pixel a, Bounded (PixelBaseComponent a), Integral (PixelBaseComponent a)) => Int -> Int -> Image a -> Image a
Files
- CHANGELOG.md +5/−0
- Codec/Picture/Extra.hs +17/−9
- JuicyPixels-extra.cabal +14/−7
- README.md +0/−1
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Juicy Pixels Extra 0.4.0++* Fix `scaleBilinear` so it works correctly with images that have 16-bit+ components.+ ## Juicy Pixels Extra 0.3.0 * Made the function `scaleBilinear` polymorphic in pixel type.
Codec/Picture/Extra.hs view
@@ -9,9 +9,11 @@ -- -- Utilities for image transformation with JuicyPixels. -{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-} module Codec.Picture.Extra ( -- * Scaling@@ -34,11 +36,13 @@ import Data.List (foldl1') import qualified Codec.Picture.Types as M --- | Scale an image using bi-linear interpolation. This is specialized to--- 'PixelRGB8' only for speed (polymorphic version is easily written, but--- it's more than twice as slow).+-- | Scale an image using bi-linear interpolation. -scaleBilinear :: (Pixel a, Integral (PixelBaseComponent a))+scaleBilinear+ :: ( Pixel a+ , Bounded (PixelBaseComponent a)+ , Integral (PixelBaseComponent a)+ ) => Int -- ^ Desired width -> Int -- ^ Desired height -> Image a -- ^ Original image@@ -96,11 +100,15 @@ mulp pixel x = colorMap (floor . (* x) . fromIntegral) pixel {-# INLINE mulp #-} -addp :: (Pixel a, Integral (PixelBaseComponent a)) => a -> a -> a+addp+ :: forall a. ( Pixel a+ , Bounded (PixelBaseComponent a)+ , Integral (PixelBaseComponent a)+ ) => a -> a -> a addp = mixWith (const f) where f x y = fromIntegral $- (0xff :: Pixel8) `min` (fromIntegral x + fromIntegral y)+ (maxBound :: PixelBaseComponent a) `min` (fromIntegral x + fromIntegral y) {-# INLINE addp #-} -- | Crop a given image. If supplied coordinates are greater than size of
JuicyPixels-extra.cabal view
@@ -1,7 +1,7 @@ name: JuicyPixels-extra-version: 0.3.0-cabal-version: >= 1.18-tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2+version: 0.4.0+cabal-version: 1.18+tested-with: GHC==7.8.4, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3 license: BSD3 license-file: LICENSE.md author: Mark Karpov <markkarpov92@gmail.com>@@ -27,12 +27,18 @@ library build-depends: base >= 4.7 && < 5- , JuicyPixels >= 3.2.6.4 && < 3.3+ , JuicyPixels >= 3.2.6.4 && < 3.4 exposed-modules: Codec.Picture.Extra if flag(dev) ghc-options: -Wall -Werror else ghc-options: -O2 -Wall+ if flag(dev) && impl(ghc >= 8.0)+ ghc-options: -Wcompat+ -Wincomplete-record-updates+ -Wincomplete-uni-patterns+ -Wnoncanonical-monad-instances+ -Wnoncanonical-monadfail-instances default-language: Haskell2010 test-suite tests@@ -40,9 +46,10 @@ hs-source-dirs: tests type: exitcode-stdio-1.0 build-depends: base >= 4.7 && < 5- , JuicyPixels >= 3.2.6.4 && < 3.3+ , JuicyPixels >= 3.2.6.4 && < 3.4 , JuicyPixels-extra , hspec >= 2.0+ build-tools: hspec-discover >= 2.0 && < 3.0 other-modules: Codec.Picture.ExtraSpec if flag(dev) ghc-options: -Wall -Werror@@ -55,9 +62,9 @@ hs-source-dirs: bench type: exitcode-stdio-1.0 build-depends: base >= 4.7 && < 5.0- , JuicyPixels >= 3.2.6.4 && < 3.3+ , JuicyPixels >= 3.2.6.4 && < 3.4 , JuicyPixels-extra- , criterion >= 0.6.2.1 && < 1.4+ , criterion >= 0.6.2.1 && < 1.6 if flag(dev) ghc-options: -O2 -Wall -Werror else
README.md view
@@ -5,7 +5,6 @@ [](http://stackage.org/nightly/package/JuicyPixels-extra) [](http://stackage.org/lts/package/JuicyPixels-extra) [](https://travis-ci.org/mrkkrp/JuicyPixels-extra)-[](https://coveralls.io/github/mrkkrp/JuicyPixels-extra?branch=master) Missing primitives you shouldn't need to re-implement yourself. I think the Haddocks are pretty self-explanatory, so head straight to them.