packages feed

massiv-io 0.2.1.0 → 0.3.0.0

raw patch · 19 files changed

+302/−305 lines, 19 filesdep ~Colordep ~massivsetup-changed

Dependency ranges changed: Color, massiv

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.3.0++* Support for `Color-0.2.0`, in particular addition of `Linearity` kind to `RGB` color+  spaces. Pixels are re-exported from `massiv-io`, hence it is a breaking change.+ # 0.2.1  * Move the package into it's own repository: [lehins/massiv-io](https://github.com/lehins/massiv-io)
README.md view
@@ -5,9 +5,9 @@  ## Status -| Language | Travis | AppVeyor | Coveralls |Gitter.im |-|:--------:|:------:|:--------:|:---------:|:--------:|-| ![GitHub top language](https://img.shields.io/github/languages/top/lehins/massiv-io.svg) | [![Travis](https://img.shields.io/travis/lehins/massiv-io/master.svg?label=Linux%20%26%20OS%20X)](https://travis-ci.org/lehins/massiv-io) | [![Build status](https://ci.appveyor.com/api/projects/status/k84digw9uo3ldqc9/branch/master?svg=true)](https://ci.appveyor.com/project/lehins/massiv-io/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/lehins/massiv-io/badge.svg?branch=master)](https://coveralls.io/github/lehins/massiv-io?branch=master) | [![Join the chat at https://gitter.im/haskell-massiv/Lobby](https://badges.gitter.im/haskell-massiv/Lobby.svg)](https://gitter.im/haskell-massiv/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)+| Language | Travis | Azure | Coveralls |Gitter.im |+|:--------:|:------:|:-----:|:---------:|:--------:|+| ![GitHub top language](https://img.shields.io/github/languages/top/lehins/massiv-io.svg) | [![Travis](https://img.shields.io/travis/lehins/massiv-io/master.svg?label=Linux%20%26%20OS%20X)](https://travis-ci.org/lehins/massiv-io) | [![Build Status](https://dev.azure.com/kuleshevich/massiv-io/_apis/build/status/lehins.massiv-io?branchName=master)](https://dev.azure.com/kuleshevich/massiv-io/_build/latest?definitionId=1?branchName=master) | [![Coverage Status](https://coveralls.io/repos/github/lehins/massiv-io/badge.svg?branch=master)](https://coveralls.io/github/lehins/massiv-io?branch=master) | [![Join the chat at https://gitter.im/haskell-massiv/Lobby](https://badges.gitter.im/haskell-massiv/Lobby.svg)](https://gitter.im/haskell-massiv/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)  |      Package       | Hackage | Nightly | LTS | |:-------------------|:-------:|:-------:|:---:|
Setup.hs view
@@ -1,33 +1,4 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-#warning You are configuring this package without cabal-doctest installed. \-         The doctests test-suite will not work as a result. \-         To fix this, install cabal-doctest before configuring.-#endif- import Distribution.Simple  main :: IO () main = defaultMain--#endif
massiv-io.cabal view
@@ -1,5 +1,5 @@ name:                massiv-io-version:             0.2.1.0+version:             0.3.0.0 synopsis:            Import/export of Image files into massiv Arrays description:         This package contains functionality for import/export of arrays                      into the real world. For now it only has the ability to read/write@@ -11,16 +11,11 @@ maintainer:          alexey@kuleshevi.ch copyright:           2018-2020 Alexey Kuleshevich category:            Data, Data Structures-build-type:          Custom+build-type:          Simple extra-doc-files:     files/*.jpg extra-source-files:  README.md                    , CHANGELOG.md cabal-version:       1.18-custom-setup-  setup-depends:-      base-    , Cabal-    , cabal-doctest >=1.0.6  library   hs-source-dirs:      src@@ -40,7 +35,7 @@                      , Data.Massiv.Array.IO.Image.Netpbm   build-depends:       base            >= 4.8 && < 5                      , bytestring-                     , Color           >= 0.1.4+                     , Color           >= 0.2                      , data-default-class                      , deepseq                      , exceptions
src/Data/Massiv/Array/IO.hs view
@@ -98,9 +98,10 @@ -- then you can read it in manually into a matching color model and then cast into a color -- space you know it is encoded in: --+-- >>> :set -XDataKinds -- >>> import qualified Graphics.ColorModel as CM -- >>> frogRGB <- readArray JPG "files/_frog.jpg" :: IO (Image S CM.RGB Word8)--- >>> let frogAdobeRGB = (fromImageBaseModel frogRGB :: Image S AdobeRGB Word8)+-- >>> let frogAdobeRGB = (fromImageBaseModel frogRGB :: Image S (AdobeRGB 'NonLinear) Word8) -- -- @since 0.1.0 readArray :: (Readable f arr, MonadIO m) =>@@ -129,8 +130,9 @@  -- | Write an array to disk. ----- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr SRGB) Word8)--- >>> frogAdobeRGB = convertImage frogYCbCr :: Image D AdobeRGB Word8+-- >>> :set -XDataKinds+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> frogAdobeRGB = convertImage frogYCbCr :: Image D (AdobeRGB 'NonLinear) Word8 -- >>> writeArray JPG def "files/_frog.jpg" $ toImageBaseModel $ computeAs S frogAdobeRGB -- -- /Note/ - On UNIX operating systems writing will happen with guarantees of atomicity and@@ -158,7 +160,8 @@ -- -- Resulting image will be read as specified by the type signature: ----- >>> frog <- readImage "files/frog.jpg" :: IO (Image S (YCbCr SRGB) Word8)+-- >>> :set -XDataKinds+-- >>> frog <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8) -- >>> size frog -- Sz (200 :. 320) --@@ -169,19 +172,19 @@ -- In case when the result image type does not match the color space or precision of the -- actual image file, `ConvertError` will be thrown. ----- >>> frog <- readImage "files/frog.jpg" :: IO (Image S SRGB Word8)--- *** Exception: ConvertError "Cannot decode JPG image <Image S YCbCr Word8> as <Image S SRGB Word8>"+-- >>> frog <- readImage "files/frog.jpg" :: IO (Image S (SRGB 'NonLinear) Word8)+-- *** Exception: ConvertError "Cannot decode JPG image <Image S YCbCr Word8> as <Image S SRGB 'NonLinear Word8>" -- -- Whenever image is not in the color space or precision that we need, either use -- `readImageAuto` or manually convert to the desired one by using the appropriate -- conversion functions: ----- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr SRGB) Word8)--- >>> let frogSRGB = convertImage frogYCbCr :: Image D SRGB Word8+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> let frogSRGB = convertImage frogYCbCr :: Image D (SRGB 'NonLinear) Word8 -- -- A simpler approach to achieve the same effect would be to use `readImageAuto`: ----- >>> frogSRGB' <- readImageAuto "files/frog.jpg" :: IO (Image S SRGB Word8)+-- >>> frogSRGB' <- readImageAuto "files/frog.jpg" :: IO (Image S (SRGB 'NonLinear) Word8) -- >>> compute frogSRGB == frogSRGB' -- True --@@ -198,7 +201,7 @@ -- and precision adjustment in order to match the result image type. Very useful whenever -- image format isn't known ahead of time. ----- >>> frogCMYK <- readImageAuto "files/frog.jpg" :: IO (Image S (CMYK SRGB) Double)+-- >>> frogCMYK <- readImageAuto "files/frog.jpg" :: IO (Image S (CMYK (SRGB 'NonLinear)) Double) -- >>> size frogCMYK -- Sz (200 :. 320) --@@ -233,8 +236,8 @@ -- on then it will be encoded as such. For example writing a TIF file in CMYK color model, -- 8bit precision and an sRGB color space: ----- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr SRGB) Word8)--- >>> writeImageAuto "files/frog.tiff" (convertImage frogYCbCr :: Image D (CMYK AdobeRGB) Word8)+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> writeImageAuto "files/frog.tiff" (convertImage frogYCbCr :: Image D (CMYK (AdobeRGB 'NonLinear)) Word8) -- -- Regardless that the color space supplied was `AdobeRGB` auto conversion will ensure it -- is stored as `SRGB`, except in `CM.CMYK` color model, since `TIF` file format supports it.
src/Data/Massiv/Array/IO/Base.hs view
@@ -53,7 +53,7 @@ import qualified Data.ByteString as B (ByteString) import qualified Data.ByteString.Lazy as BL (ByteString) import Data.Default.Class (Default(..))-import Data.Massiv.Array as A+import qualified Data.Massiv.Array as A import Data.Massiv.Array.Manifest.Vector import Data.Typeable import qualified Data.Vector.Storable as V@@ -61,7 +61,7 @@ import Graphics.Pixel.ColorSpace import Unsafe.Coerce -type Image r cs e = Array r Ix2 (Pixel cs e)+type Image r cs e = A.Array r A.Ix2 (Pixel cs e)  -- | Conversion error, which is thrown when there is a mismatch between the -- expected array type and the one supported by the file format. It is also@@ -257,16 +257,16 @@ -- -- @since 0.2.0 convertImage ::-     (Source r' Ix2 (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e)+     (A.Source r' A.Ix2 (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e)   => Image r' cs' e'-  -> Image D cs e+  -> Image A.D cs e convertImage = A.map convertPixel  -- | Cast an array. This is theoretically unsafe operation, but for all currently -- available `ColorSpace` instances this function is perfectly safe. -- -- @since 0.2.0-toImageBaseModel :: Array S Ix2 (Pixel cs e) -> Array S Ix2 (Pixel (BaseModel cs) e)+toImageBaseModel :: A.Array A.S A.Ix2 (Pixel cs e) -> A.Array A.S A.Ix2 (Pixel (BaseModel cs) e) toImageBaseModel = unsafeCoerce  @@ -274,7 +274,7 @@ -- available `ColorSpace` instances this function is perfectly safe. -- -- @since 0.2.0-fromImageBaseModel :: Array S Ix2 (Pixel (BaseModel cs) e) -> Array S Ix2 (Pixel cs e)+fromImageBaseModel :: A.Array A.S A.Ix2 (Pixel (BaseModel cs) e) -> A.Array A.S A.Ix2 (Pixel cs e) fromImageBaseModel = unsafeCoerce  @@ -282,7 +282,7 @@ -- `CM.Y` color model -- -- @since 0.2.1-demoteLumaImage :: Array S Ix2 (Pixel Y' e) -> Array S Ix2 (Pixel CM.Y e)+demoteLumaImage :: A.Array A.S A.Ix2 (Pixel Y' e) -> A.Array A.S A.Ix2 (Pixel CM.Y e) demoteLumaImage = unsafeCoerce  @@ -290,32 +290,34 @@ -- with Luma pixels -- -- @since 0.2.1-promoteLumaImage :: Array S Ix2 (Pixel CM.Y e) -> Array S Ix2 (Pixel Y' e)+promoteLumaImage :: A.Array A.S A.Ix2 (Pixel CM.Y e) -> A.Array A.S A.Ix2 (Pixel Y' e) promoteLumaImage = unsafeCoerce  -- | Same as `demoteLumaImage`, but with Alpha channel -- -- @since 0.2.1-demoteLumaAlphaImage :: Array S Ix2 (Pixel (Alpha Y') e) -> Array S Ix2 (Pixel (Alpha CM.Y) e)+demoteLumaAlphaImage ::+     A.Array A.S A.Ix2 (Pixel (Alpha Y') e) -> A.Array A.S A.Ix2 (Pixel (Alpha CM.Y) e) demoteLumaAlphaImage = unsafeCoerce   -- | Same as `promoteLumaImage` but with Alpha channel -- -- @since 0.2.1-promoteLumaAlphaImage :: Array S Ix2 (Pixel (Alpha CM.Y) e) -> Array S Ix2 (Pixel (Alpha Y') e)+promoteLumaAlphaImage ::+     A.Array A.S A.Ix2 (Pixel (Alpha CM.Y) e) -> A.Array A.S A.Ix2 (Pixel (Alpha Y') e) promoteLumaAlphaImage = unsafeCoerce    unsafeFromStorableVectorM ::-     (MonadThrow m, Index ix, Storable a, Storable b)-  => Sz ix+     (MonadThrow m, A.Index ix, A.Storable a, A.Storable b)+  => A.Sz ix   -> V.Vector a-  -> m (Array S ix b)+  -> m (A.Array A.S ix b) unsafeFromStorableVectorM sz v = #if MIN_VERSION_massiv(0,5,0)-    resizeM sz $ fromStorableVector Par $ V.unsafeCast v+    resizeM sz $ A.fromStorableVector A.Par $ V.unsafeCast v #else-    fromVectorM Par sz $ V.unsafeCast v+    fromVectorM A.Par sz $ V.unsafeCast v #endif
src/Data/Massiv/Array/IO/Image/JuicyPixels/BMP.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -82,10 +83,10 @@ instance Writable BMP (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable BMP (Image S SRGB Word8) where+instance Writable BMP (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable BMP (Image S (Alpha SRGB) Word8) where+instance Writable BMP (Image S (Alpha (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>@@ -108,10 +109,10 @@ instance Readable BMP (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable BMP (Image S SRGB Word8) where+instance Readable BMP (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable BMP (Image S (Alpha SRGB) Word8) where+instance Readable BMP (Image S (Alpha (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -- | Decode a Bitmap Image
src/Data/Massiv/Array/IO/Image/JuicyPixels/Base.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-}@@ -200,50 +201,50 @@     JP.ImageRGB8 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.RGB Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel SRGB Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel AdobeRGB Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (SRGB 'NonLinear) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (AdobeRGB 'NonLinear) Word8))         ]     JP.ImageRGB16 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.RGB Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel SRGB Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel AdobeRGB Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (SRGB 'NonLinear) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (AdobeRGB 'NonLinear) Word16))         ]     JP.ImageRGBF jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.RGB Float))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel SRGB Float))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel AdobeRGB Float))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (SRGB 'NonLinear) Float))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (AdobeRGB 'NonLinear) Float))         ]     JP.ImageRGBA8 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.RGB) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha SRGB) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha AdobeRGB) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (SRGB 'NonLinear)) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (AdobeRGB 'NonLinear)) Word8))         ]     JP.ImageRGBA16 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.RGB) Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha SRGB) Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha AdobeRGB) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (SRGB 'NonLinear)) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (AdobeRGB 'NonLinear)) Word16))         ]     JP.ImageYCbCr8 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.YCbCr Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr SRGB) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr AdobeRGB) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr (SRGB 'NonLinear)) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr (AdobeRGB 'NonLinear)) Word8))         ]     JP.ImageCMYK8 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.CMYK Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK SRGB) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK AdobeRGB) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK (SRGB 'NonLinear)) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK (AdobeRGB 'NonLinear)) Word8))         ]     JP.ImageCMYK16 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.CMYK Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK SRGB) Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK AdobeRGB) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK (SRGB 'NonLinear)) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (CMYK (AdobeRGB 'NonLinear)) Word16))         ]  fromDynamicImage ::@@ -315,21 +316,26 @@     JP.ImageYA16 jimg ->       compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (Alpha (Y D65)) Word16))     JP.ImageRGB8 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S SRGB Word8))+      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (SRGB 'NonLinear) Word8))     JP.ImageRGB16 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S SRGB Word16))+      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (SRGB 'NonLinear) Word16))     JP.ImageRGBF jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S SRGB Float))+      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (SRGB 'NonLinear) Float))     JP.ImageRGBA8 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (Alpha SRGB) Word8))+      compute . convertImage <$>+      (fromJPImageUnsafeM jimg :: m (Image S (Alpha (SRGB 'NonLinear)) Word8))     JP.ImageRGBA16 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (Alpha SRGB) Word16))+      compute . convertImage <$>+      (fromJPImageUnsafeM jimg :: m (Image S (Alpha (SRGB 'NonLinear)) Word16))     JP.ImageYCbCr8 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (YCbCr SRGB) Word8))+      compute . convertImage <$>+      (fromJPImageUnsafeM jimg :: m (Image S (YCbCr (SRGB 'NonLinear)) Word8))     JP.ImageCMYK8 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (CMYK SRGB) Word8))+      compute . convertImage <$>+      (fromJPImageUnsafeM jimg :: m (Image S (CMYK (SRGB 'NonLinear)) Word8))     JP.ImageCMYK16 jimg ->-      compute . convertImage <$> (fromJPImageUnsafeM jimg :: m (Image S (CMYK SRGB) Word16))+      compute . convertImage <$>+      (fromJPImageUnsafeM jimg :: m (Image S (CMYK (SRGB 'NonLinear)) Word16))   @@ -485,8 +491,8 @@ maybeJPImageRGB8 img =   msum     [ (\Refl -> toJPImageRGB8 img) <$> (eqT :: Maybe (cs :~: CM.RGB))-    , (\Refl -> toJPImageRGB8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB))-    , (\Refl -> toJPImageRGB8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB))+    , (\Refl -> toJPImageRGB8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB 'NonLinear))+    , (\Refl -> toJPImageRGB8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear))     ] {-# INLINE maybeJPImageRGB8 #-} @@ -503,8 +509,8 @@ maybeJPImageRGB16 img =   msum     [ (\Refl -> toJPImageRGB16 img) <$> (eqT :: Maybe (cs :~: CM.RGB))-    , (\Refl -> toJPImageRGB16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB))-    , (\Refl -> toJPImageRGB16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB))+    , (\Refl -> toJPImageRGB16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB 'NonLinear))+    , (\Refl -> toJPImageRGB16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear))     ] {-# INLINE maybeJPImageRGB16 #-} @@ -520,8 +526,8 @@ maybeJPImageRGBF img =   msum     [ (\Refl -> toJPImageRGBF img) <$> (eqT :: Maybe (cs :~: CM.RGB))-    , (\Refl -> toJPImageRGBF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB))-    , (\Refl -> toJPImageRGBF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB))+    , (\Refl -> toJPImageRGBF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB 'NonLinear))+    , (\Refl -> toJPImageRGBF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear))     ] {-# INLINE maybeJPImageRGBF #-} @@ -540,8 +546,9 @@ maybeJPImageRGBA8 img =   msum     [ (\Refl -> toJPImageRGBA8 img) <$> (eqT :: Maybe (cs :~: CM.RGB))-    , (\Refl -> toJPImageRGBA8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB))-    , (\Refl -> toJPImageRGBA8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB))+    , (\Refl -> toJPImageRGBA8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB 'NonLinear))+    , (\Refl -> toJPImageRGBA8 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear))     ] {-# INLINE maybeJPImageRGBA8 #-} @@ -560,8 +567,10 @@ maybeJPImageRGBA16 img =   msum     [ (\Refl -> toJPImageRGBA16 img) <$> (eqT :: Maybe (cs :~: CM.RGB))-    , (\Refl -> toJPImageRGBA16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: SRGB))-    , (\Refl -> toJPImageRGBA16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: AdobeRGB))+    , (\Refl -> toJPImageRGBA16 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: SRGB 'NonLinear))+    , (\Refl -> toJPImageRGBA16 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear))     ] {-# INLINE maybeJPImageRGBA16 #-} @@ -578,8 +587,9 @@ maybeJPImageYCbCr8 img =   msum     [ (\Refl -> toJPImageYCbCr8 img) <$> (eqT :: Maybe (cs :~: CM.YCbCr))-    , (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: YCbCr SRGB))-    --, (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: YCbCr AdobeRGB))+    , (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: YCbCr (SRGB 'NonLinear)))+    --, (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: YCbCr (AdobeRGB 'NonLinear)))     ] {-# INLINE maybeJPImageYCbCr8 #-} @@ -597,8 +607,10 @@ maybeJPImageCMYK8 img =   msum     [ (\Refl -> toJPImageCMYK8 img) <$> (eqT :: Maybe (cs :~: CM.CMYK))-    , (\Refl -> toJPImageCMYK8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: CMYK SRGB))-    , (\Refl -> toJPImageCMYK8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: CMYK AdobeRGB))+    , (\Refl -> toJPImageCMYK8 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: CMYK (SRGB 'NonLinear)))+    , (\Refl -> toJPImageCMYK8 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: CMYK (AdobeRGB 'NonLinear)))     ] {-# INLINE maybeJPImageCMYK8 #-} @@ -616,8 +628,10 @@ maybeJPImageCMYK16 img =   msum     [ (\Refl -> toJPImageCMYK16 img) <$> (eqT :: Maybe (cs :~: CM.CMYK))-    , (\Refl -> toJPImageCMYK16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: CMYK SRGB))-    , (\Refl -> toJPImageCMYK16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: CMYK AdobeRGB))+    , (\Refl -> toJPImageCMYK16 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: CMYK (SRGB 'NonLinear)))+    , (\Refl -> toJPImageCMYK16 $ toImageBaseModel img) <$>+      (eqT :: Maybe (cs :~: CMYK (AdobeRGB 'NonLinear)))     ] {-# INLINE maybeJPImageCMYK16 #-} @@ -646,22 +660,22 @@ -- Conversion to sRGB color space based color models  toYCbCr8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.YCbCr Word8-toYCbCr8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (YCbCr SRGB) Word8)+toYCbCr8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (YCbCr (SRGB 'NonLinear)) Word8)  toCMYK8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.CMYK Word8-toCMYK8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (CMYK SRGB) Word8)+toCMYK8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (CMYK (SRGB 'NonLinear)) Word8)  toCMYK16 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.CMYK Word16-toCMYK16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (CMYK SRGB) Word16)+toCMYK16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (CMYK (SRGB 'NonLinear)) Word16)  toSRGB8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.RGB Word8-toSRGB8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel SRGB Word8)+toSRGB8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (SRGB 'NonLinear) Word8)  toSRGB16 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.RGB Word16-toSRGB16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel SRGB Word16)+toSRGB16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (SRGB 'NonLinear) Word16)  toSRGBA8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel (Alpha CM.RGB) Word8-toSRGBA8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (Alpha SRGB) Word8)+toSRGBA8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (Alpha (SRGB 'NonLinear)) Word8)  toSRGBA16 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel (Alpha CM.RGB) Word16-toSRGBA16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (Alpha SRGB) Word16)+toSRGBA16 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (Alpha (SRGB 'NonLinear)) Word16)
src/Data/Massiv/Array/IO/Image/JuicyPixels/GIF.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-}@@ -89,7 +90,7 @@ instance Writable GIF (Image S (Y D65) Word8) where   encodeM GIF opts = encodeM GIF opts . toImageBaseModel -instance Writable GIF (Image S SRGB Word8) where+instance Writable GIF (Image S (SRGB 'NonLinear) Word8) where   encodeM GIF opts = encodeM GIF opts . toImageBaseModel  encodePalettizedRGB ::@@ -114,11 +115,11 @@   decodeM = decodeGIF   decodeWithMetadataM = decodeWithMetadataGIF -instance Readable GIF (Image S SRGB Word8) where+instance Readable GIF (Image S (SRGB 'NonLinear) Word8) where   decodeM f = fmap fromImageBaseModel . decodeM f   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable GIF (Image S (Alpha SRGB) Word8) where+instance Readable GIF (Image S (Alpha (SRGB 'NonLinear)) Word8) where   decodeM f = fmap fromImageBaseModel . decodeM f   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f @@ -172,10 +173,10 @@           | Just Refl <- (eqT :: Maybe (e :~: Word8))           , Just Refl <- (eqT :: Maybe (cs :~: CM.RGB)) -> encodePalettizedRGB opts img           | Just Refl <- (eqT :: Maybe (e :~: Word8))-          , Just Refl <- (eqT :: Maybe (cs :~: SRGB)) ->+          , Just Refl <- (eqT :: Maybe (cs :~: (SRGB 'NonLinear))) ->             encodePalettizedRGB opts $ toImageBaseModel img           | Just Refl <- (eqT :: Maybe (e :~: Word8))-          , Just Refl <- (eqT :: Maybe (cs :~: AdobeRGB)) ->+          , Just Refl <- (eqT :: Maybe (cs :~: (AdobeRGB 'NonLinear))) ->             encodePalettizedRGB opts $ toImageBaseModel img         Nothing -> fromMaybeEncode f (Proxy :: Proxy (Image S cs e)) Nothing @@ -220,11 +221,11 @@   decodeM = decodeSequenceGIF   decodeWithMetadataM = decodeSequenceWithMetadataGIF -instance Readable (Sequence GIF) [Image S SRGB Word8] where+instance Readable (Sequence GIF) [Image S (SRGB 'NonLinear) Word8] where   decodeM f = fmap (fmap fromImageBaseModel) . decodeM f   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f -instance Readable (Sequence GIF) [Image S (Alpha SRGB) Word8] where+instance Readable (Sequence GIF) [Image S (Alpha (SRGB 'NonLinear)) Word8] where   decodeM f = fmap (fmap fromImageBaseModel) . decodeM f   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f @@ -357,20 +358,20 @@ instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Y D65) Word8)) where   encodeM f opts = encodeM f opts . fmap (fmap toImageBaseModel) -instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S SRGB Word8)) where+instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (SRGB 'NonLinear) Word8)) where   encodeM f opts = encodeM f opts . fmap (fmap toImageBaseModel) -instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Alpha SRGB) Word8)) where+instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Alpha (SRGB 'NonLinear)) Word8)) where   encodeM f opts = encodeM f opts . fmap (fmap toImageBaseModel)  instance Writable (Sequence GIF) (NE.NonEmpty ( JP.GifDelay                                               , JP.GifDisposalMethod-                                              , Image S SRGB Word8)) where+                                              , Image S (SRGB 'NonLinear) Word8)) where   encodeM f opts = encodeM f opts . fmap (\(dl, dp, i) -> (dl, dp, toImageBaseModel i))  instance Writable (Sequence GIF) (NE.NonEmpty ( JP.GifDelay                                               , JP.GifDisposalMethod-                                              , Image S (Alpha SRGB) Word8)) where+                                              , Image S (Alpha (SRGB 'NonLinear)) Word8)) where   encodeM f opts = encodeM f opts . fmap (\(dl, dp, i) -> (dl, dp, toImageBaseModel i))  @@ -378,4 +379,4 @@          Writable (Auto (Sequence GIF)) (NE.NonEmpty (JP.GifDelay, Image r cs e)) where   encodeM (Auto f) opts =     encodeM f opts .-    fmap (fmap (computeAs S . (convertImage :: Image r cs e -> Image D SRGB Word8)))+    fmap (fmap (computeAs S . (convertImage :: Image r cs e -> Image D (SRGB 'NonLinear) Word8)))
src/Data/Massiv/Array/IO/Image/JuicyPixels/HDR.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -73,7 +74,7 @@ instance Writable HDR (Image S CM.RGB Float) where   encodeM HDR opts = pure . getHdrEncoder opts . toJPImageRGBF -instance Writable HDR (Image S SRGB Float) where+instance Writable HDR (Image S (SRGB 'NonLinear) Float) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>@@ -84,7 +85,7 @@ instance Readable HDR (Image S CM.RGB Float) where   decodeWithMetadataM = decodeWithMetadataHDR -instance Readable HDR (Image S SRGB Float) where+instance Readable HDR (Image S (SRGB 'NonLinear) Float) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -- | Decode a HDR Image@@ -140,6 +141,6 @@   -> BL.ByteString encodeAutoHDR _ opts = toHdr (toPixelBaseModel . toSRGBF)   where-    toSRGBF = convertPixel :: Pixel cs e -> Pixel SRGB Float+    toSRGBF = convertPixel :: Pixel cs e -> Pixel (SRGB 'NonLinear) Float     toHdr :: Source r Ix2 a => (a -> Pixel CM.RGB Float) -> Array r Ix2 a -> BL.ByteString     toHdr adjustPixel = getHdrEncoder opts . toJPImageRGBF . A.map adjustPixel
src/Data/Massiv/Array/IO/Image/JuicyPixels/JPG.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -90,13 +91,13 @@ instance Writable JPG (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable JPG (Image S SRGB Word8) where+instance Writable JPG (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable JPG (Image S (YCbCr SRGB) Word8) where+instance Writable JPG (Image S (YCbCr (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable JPG (Image S (CMYK SRGB) Word8) where+instance Writable JPG (Image S (CMYK (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>@@ -131,13 +132,13 @@ instance Readable JPG (Image S (Alpha (Y D65)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable JPG (Image S SRGB Word8) where+instance Readable JPG (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable JPG (Image S (CMYK SRGB) Word8) where+instance Readable JPG (Image S (CMYK (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable JPG (Image S (YCbCr SRGB) Word8) where+instance Readable JPG (Image S (YCbCr (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  
src/Data/Massiv/Array/IO/Image/JuicyPixels/PNG.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -102,16 +103,16 @@ instance Writable PNG (Image S (Alpha (Y D65)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S SRGB Word8) where+instance Writable PNG (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S SRGB Word16) where+instance Writable PNG (Image S (SRGB 'NonLinear) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S (Alpha SRGB) Word8) where+instance Writable PNG (Image S (Alpha (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S (Alpha SRGB) Word16) where+instance Writable PNG (Image S (Alpha (SRGB 'NonLinear)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>@@ -168,16 +169,16 @@ instance Readable PNG (Image S (Alpha (Y D65)) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S SRGB Word8) where+instance Readable PNG (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S SRGB Word16) where+instance Readable PNG (Image S (SRGB 'NonLinear) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S (Alpha SRGB) Word8) where+instance Readable PNG (Image S (Alpha (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S (Alpha SRGB) Word16) where+instance Readable PNG (Image S (Alpha (SRGB 'NonLinear)) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f  -- | Decode a Png Image
src/Data/Massiv/Array/IO/Image/JuicyPixels/TGA.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -70,10 +71,10 @@ instance Writable TGA (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TGA (Image S SRGB Word8) where+instance Writable TGA (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TGA (Image S (Alpha SRGB) Word8) where+instance Writable TGA (Image S (Alpha (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel  @@ -98,10 +99,10 @@ instance Readable TGA (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TGA (Image S SRGB Word8) where+instance Readable TGA (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TGA (Image S (Alpha SRGB) Word8) where+instance Readable TGA (Image S (Alpha (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -- | Decode a Tga Image
src/Data/Massiv/Array/IO/Image/JuicyPixels/TIF.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -136,25 +137,25 @@ instance Writable TIF (Image S (Alpha (Y D65)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S SRGB Word8) where+instance Writable TIF (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S SRGB Word16) where+instance Writable TIF (Image S (SRGB 'NonLinear) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (Alpha SRGB) Word8) where+instance Writable TIF (Image S (Alpha (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (Alpha SRGB) Word16) where+instance Writable TIF (Image S (Alpha (SRGB 'NonLinear)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (YCbCr SRGB) Word8) where+instance Writable TIF (Image S (YCbCr (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (CMYK SRGB) Word8) where+instance Writable TIF (Image S (CMYK (SRGB 'NonLinear)) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (CMYK SRGB) Word16) where+instance Writable TIF (Image S (CMYK (SRGB 'NonLinear)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>@@ -235,22 +236,22 @@ instance Readable TIF (Image S (Alpha (Y D65)) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S SRGB Word8) where+instance Readable TIF (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S SRGB Word16) where+instance Readable TIF (Image S (SRGB 'NonLinear) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (Alpha SRGB) Word8) where+instance Readable TIF (Image S (Alpha (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (Alpha SRGB) Word16) where+instance Readable TIF (Image S (Alpha (SRGB 'NonLinear)) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (CMYK SRGB) Word8) where+instance Readable TIF (Image S (CMYK (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (CMYK SRGB) Word16) where+instance Readable TIF (Image S (CMYK (SRGB 'NonLinear)) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -- | Decode a Tiff Image
src/Data/Massiv/Array/IO/Image/Netpbm.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -35,11 +36,10 @@ import Control.Monad (guard) import Data.Bifunctor (first) import qualified Data.ByteString as B (ByteString)-import Data.Massiv.Array as M+import Data.Massiv.Array as A import Data.Massiv.Array.IO.Base import Data.Typeable import qualified Data.Vector.Storable as V-import Foreign.Storable (Storable) import Graphics.Netpbm as Netpbm hiding (PPM) import qualified Graphics.Netpbm as Netpbm (PPM(..)) import qualified Graphics.Pixel as CM@@ -225,9 +225,9 @@   decodeWithMetadataM = decodeNetpbmImage  -instance Readable PPM (Image S SRGB Word8) where+instance Readable PPM (Image S (SRGB 'NonLinear) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f-instance Readable PPM (Image S SRGB Word16) where+instance Readable PPM (Image S (SRGB 'NonLinear) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  @@ -237,9 +237,9 @@   decodeWithMetadataM = decodePPMs fromNetpbmImage  -instance Readable (Sequence PPM) [Image S SRGB Word8] where+instance Readable (Sequence PPM) [Image S (SRGB 'NonLinear) Word8] where   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f-instance Readable (Sequence PPM) [Image S SRGB Word16] where+instance Readable (Sequence PPM) [Image S (SRGB 'NonLinear) Word16] where   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f  @@ -297,6 +297,8 @@     PgmPixelData16 v ->       compute . convertImage <$> (fromNetpbmImageUnsafe m n v :: Maybe (Image S (Y D65) Word16))     PpmPixelDataRGB8 v ->-      compute . convertImage <$> (fromNetpbmImageUnsafe m n v :: Maybe (Image S SRGB Word8))+      compute . convertImage <$>+      (fromNetpbmImageUnsafe m n v :: Maybe (Image S (SRGB 'NonLinear) Word8))     PpmPixelDataRGB16 v ->-      compute . convertImage <$> (fromNetpbmImageUnsafe m n v :: Maybe (Image S SRGB Word16))+      compute . convertImage <$>+      (fromNetpbmImageUnsafe m n v :: Maybe (Image S (SRGB 'NonLinear) Word16))
tests/Test/Massiv/Array/IO/Image/AutoSpec.hs view
@@ -1,8 +1,9 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE AllowAmbiguousTypes #-} module Test.Massiv.Array.IO.Image.AutoSpec (spec) where  import Data.Massiv.Array@@ -29,83 +30,83 @@      , Readable (Auto f) (Image S (Y D65) Word16)      , Readable (Auto f) (Image S (Y D65) Word32)      , Readable (Auto f) (Image S (Y D65) Word64)-     , Readable (Auto f) (Image S (CMYK SRGB) Word8)-     , Readable (Auto f) (Image S (CMYK SRGB) Word16)-     , Readable (Auto f) (Image S (CMYK SRGB) Word32)-     , Readable (Auto f) (Image S (CMYK SRGB) Word64)-     , Readable (Auto f) (Image S (CMYK AdobeRGB) Word8)-     , Readable (Auto f) (Image S (CMYK AdobeRGB) Word16)-     , Readable (Auto f) (Image S (CMYK AdobeRGB) Word32)-     , Readable (Auto f) (Image S (CMYK AdobeRGB) Word64)-     , Readable (Auto f) (Image S (YCbCr SRGB) Word8)-     , Readable (Auto f) (Image S (YCbCr SRGB) Word16)-     , Readable (Auto f) (Image S (YCbCr SRGB) Word32)-     , Readable (Auto f) (Image S (YCbCr SRGB) Word64)-     -- AdobeRGB doesn't have Luma instance-     -- , Readable (Auto f) (Image S (YCbCr AdobeRGB) Word8)-     -- , Readable (Auto f) (Image S (YCbCr AdobeRGB) Word16)-     -- , Readable (Auto f) (Image S (YCbCr AdobeRGB) Word32)-     -- , Readable (Auto f) (Image S (YCbCr AdobeRGB) Word64)+     , Readable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word8)+     , Readable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word16)+     , Readable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word32)+     , Readable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word64)+     , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word8)+     , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word16)+     , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word32)+     , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word64)+     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word8)+     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word16)+     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word32)+     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word64)+     -- (AdobeRGB 'NonLinear) doesn't have Luma instance+     -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word8)+     -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word16)+     -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word32)+     -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word64)      , Readable (Auto f) (Image S (Alpha (Y D65)) Word8)      , Readable (Auto f) (Image S (Alpha (Y D65)) Word16)      , Readable (Auto f) (Image S (Alpha (Y D65)) Word32)      , Readable (Auto f) (Image S (Alpha (Y D65)) Word64)-     , Readable (Auto f) (Image S (Alpha SRGB) Word8)-     , Readable (Auto f) (Image S (Alpha SRGB) Word16)-     , Readable (Auto f) (Image S (Alpha SRGB) Word32)-     , Readable (Auto f) (Image S (Alpha SRGB) Word64)-     , Readable (Auto f) (Image S (Alpha AdobeRGB) Word8)-     , Readable (Auto f) (Image S (Alpha AdobeRGB) Word16)-     , Readable (Auto f) (Image S (Alpha AdobeRGB) Word32)-     , Readable (Auto f) (Image S (Alpha AdobeRGB) Word64)-     , Readable (Auto f) (Image S SRGB Word8)-     , Readable (Auto f) (Image S SRGB Word16)-     , Readable (Auto f) (Image S SRGB Word32)-     , Readable (Auto f) (Image S SRGB Word64)-     , Readable (Auto f) (Image S AdobeRGB Word8)-     , Readable (Auto f) (Image S AdobeRGB Word16)-     , Readable (Auto f) (Image S AdobeRGB Word32)-     , Readable (Auto f) (Image S AdobeRGB Word64)+     , Readable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word8)+     , Readable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word16)+     , Readable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word32)+     , Readable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word64)+     , Readable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word8)+     , Readable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word16)+     , Readable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word32)+     , Readable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word64)+     , Readable (Auto f) (Image S (SRGB 'NonLinear) Word8)+     , Readable (Auto f) (Image S (SRGB 'NonLinear) Word16)+     , Readable (Auto f) (Image S (SRGB 'NonLinear) Word32)+     , Readable (Auto f) (Image S (SRGB 'NonLinear) Word64)+     , Readable (Auto f) (Image S (AdobeRGB 'NonLinear) Word8)+     , Readable (Auto f) (Image S (AdobeRGB 'NonLinear) Word16)+     , Readable (Auto f) (Image S (AdobeRGB 'NonLinear) Word32)+     , Readable (Auto f) (Image S (AdobeRGB 'NonLinear) Word64)      , Writable (Auto f) (Image S (Y D65) Word8)      , Writable (Auto f) (Image S (Y D65) Word16)      , Writable (Auto f) (Image S (Y D65) Word32)      , Writable (Auto f) (Image S (Y D65) Word64)-     , Writable (Auto f) (Image S (CMYK SRGB) Word8)-     , Writable (Auto f) (Image S (CMYK SRGB) Word16)-     , Writable (Auto f) (Image S (CMYK SRGB) Word32)-     , Writable (Auto f) (Image S (CMYK SRGB) Word64)-     , Writable (Auto f) (Image S (CMYK AdobeRGB) Word8)-     , Writable (Auto f) (Image S (CMYK AdobeRGB) Word16)-     , Writable (Auto f) (Image S (CMYK AdobeRGB) Word32)-     , Writable (Auto f) (Image S (CMYK AdobeRGB) Word64)-     , Writable (Auto f) (Image S (YCbCr SRGB) Word8)-     , Writable (Auto f) (Image S (YCbCr SRGB) Word16)-     , Writable (Auto f) (Image S (YCbCr SRGB) Word32)-     , Writable (Auto f) (Image S (YCbCr SRGB) Word64)-     -- , Writable (Auto f) (Image S (YCbCr AdobeRGB) Word8)-     -- , Writable (Auto f) (Image S (YCbCr AdobeRGB) Word16)-     -- , Writable (Auto f) (Image S (YCbCr AdobeRGB) Word32)-     -- , Writable (Auto f) (Image S (YCbCr AdobeRGB) Word64)+     , Writable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word8)+     , Writable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word16)+     , Writable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word32)+     , Writable (Auto f) (Image S (CMYK (SRGB 'NonLinear)) Word64)+     , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word8)+     , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word16)+     , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word32)+     , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word64)+     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word8)+     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word16)+     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word32)+     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word64)+     -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word8)+     -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word16)+     -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word32)+     -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word64)      , Writable (Auto f) (Image S (Alpha (Y D65)) Word8)      , Writable (Auto f) (Image S (Alpha (Y D65)) Word16)      , Writable (Auto f) (Image S (Alpha (Y D65)) Word32)      , Writable (Auto f) (Image S (Alpha (Y D65)) Word64)-     , Writable (Auto f) (Image S (Alpha SRGB) Word8)-     , Writable (Auto f) (Image S (Alpha SRGB) Word16)-     , Writable (Auto f) (Image S (Alpha SRGB) Word32)-     , Writable (Auto f) (Image S (Alpha SRGB) Word64)-     , Writable (Auto f) (Image S (Alpha AdobeRGB) Word8)-     , Writable (Auto f) (Image S (Alpha AdobeRGB) Word16)-     , Writable (Auto f) (Image S (Alpha AdobeRGB) Word32)-     , Writable (Auto f) (Image S (Alpha AdobeRGB) Word64)-     , Writable (Auto f) (Image S SRGB Word8)-     , Writable (Auto f) (Image S SRGB Word16)-     , Writable (Auto f) (Image S SRGB Word32)-     , Writable (Auto f) (Image S SRGB Word64)-     , Writable (Auto f) (Image S AdobeRGB Word8)-     , Writable (Auto f) (Image S AdobeRGB Word16)-     , Writable (Auto f) (Image S AdobeRGB Word32)-     , Writable (Auto f) (Image S AdobeRGB Word64)+     , Writable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word8)+     , Writable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word16)+     , Writable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word32)+     , Writable (Auto f) (Image S (Alpha (SRGB 'NonLinear)) Word64)+     , Writable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word8)+     , Writable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word16)+     , Writable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word32)+     , Writable (Auto f) (Image S (Alpha (AdobeRGB 'NonLinear)) Word64)+     , Writable (Auto f) (Image S (SRGB 'NonLinear) Word8)+     , Writable (Auto f) (Image S (SRGB 'NonLinear) Word16)+     , Writable (Auto f) (Image S (SRGB 'NonLinear) Word32)+     , Writable (Auto f) (Image S (SRGB 'NonLinear) Word64)+     , Writable (Auto f) (Image S (AdobeRGB 'NonLinear) Word8)+     , Writable (Auto f) (Image S (AdobeRGB 'NonLinear) Word16)+     , Writable (Auto f) (Image S (AdobeRGB 'NonLinear) Word32)+     , Writable (Auto f) (Image S (AdobeRGB 'NonLinear) Word64)      )   => f   -> Spec@@ -119,35 +120,35 @@       specEncodeDecodeAutoNoError @(Alpha (Y D65)) @Word16 f       specEncodeDecodeAutoNoError @(Alpha (Y D65)) @Word32 f       specEncodeDecodeAutoNoError @(Alpha (Y D65)) @Word64 f-      specEncodeDecodeAutoNoError @SRGB @Word8 f-      specEncodeDecodeAutoNoError @SRGB @Word16 f-      specEncodeDecodeAutoNoError @SRGB @Word32 f-      specEncodeDecodeAutoNoError @SRGB @Word64 f-      specEncodeDecodeAutoNoError @(Alpha SRGB) @Word8 f-      specEncodeDecodeAutoNoError @(Alpha SRGB) @Word16 f-      specEncodeDecodeAutoNoError @(Alpha SRGB) @Word32 f-      specEncodeDecodeAutoNoError @(Alpha SRGB) @Word64 f-      specEncodeDecodeAutoNoError @(CMYK SRGB) @Word8 f-      specEncodeDecodeAutoNoError @(CMYK SRGB) @Word16 f-      specEncodeDecodeAutoNoError @(CMYK SRGB) @Word32 f-      specEncodeDecodeAutoNoError @(CMYK SRGB) @Word64 f-      specEncodeDecodeAutoNoError @(YCbCr SRGB) @Word8 f-      specEncodeDecodeAutoNoError @(YCbCr SRGB) @Word16 f-      specEncodeDecodeAutoNoError @(YCbCr SRGB) @Word32 f-      specEncodeDecodeAutoNoError @(YCbCr SRGB) @Word64 f-      specEncodeDecodeAutoNoError @AdobeRGB @Word8 f-      specEncodeDecodeAutoNoError @AdobeRGB @Word16 f-      specEncodeDecodeAutoNoError @AdobeRGB @Word32 f-      specEncodeDecodeAutoNoError @AdobeRGB @Word64 f-      specEncodeDecodeAutoNoError @(Alpha AdobeRGB) @Word8 f-      specEncodeDecodeAutoNoError @(Alpha AdobeRGB) @Word16 f-      specEncodeDecodeAutoNoError @(Alpha AdobeRGB) @Word32 f-      specEncodeDecodeAutoNoError @(Alpha AdobeRGB) @Word64 f-      specEncodeDecodeAutoNoError @(CMYK AdobeRGB) @Word8 f-      specEncodeDecodeAutoNoError @(CMYK AdobeRGB) @Word16 f-      specEncodeDecodeAutoNoError @(CMYK AdobeRGB) @Word32 f-      specEncodeDecodeAutoNoError @(CMYK AdobeRGB) @Word64 f-      -- specEncodeDecodeAutoNoError @(YCbCr AdobeRGB) @Word8 f-      -- specEncodeDecodeAutoNoError @(YCbCr AdobeRGB) @Word16 f-      -- specEncodeDecodeAutoNoError @(YCbCr AdobeRGB) @Word32 f-      -- specEncodeDecodeAutoNoError @(YCbCr AdobeRGB) @Word64 f+      specEncodeDecodeAutoNoError @(SRGB 'NonLinear) @Word8 f+      specEncodeDecodeAutoNoError @(SRGB 'NonLinear) @Word16 f+      specEncodeDecodeAutoNoError @(SRGB 'NonLinear) @Word32 f+      specEncodeDecodeAutoNoError @(SRGB 'NonLinear) @Word64 f+      specEncodeDecodeAutoNoError @(Alpha (SRGB 'NonLinear)) @Word8 f+      specEncodeDecodeAutoNoError @(Alpha (SRGB 'NonLinear)) @Word16 f+      specEncodeDecodeAutoNoError @(Alpha (SRGB 'NonLinear)) @Word32 f+      specEncodeDecodeAutoNoError @(Alpha (SRGB 'NonLinear)) @Word64 f+      specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word8 f+      specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word16 f+      specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word32 f+      specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word64 f+      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word8 f+      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word16 f+      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word32 f+      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word64 f+      specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word8 f+      specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word16 f+      specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word32 f+      specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word64 f+      specEncodeDecodeAutoNoError @(Alpha (AdobeRGB 'NonLinear)) @Word8 f+      specEncodeDecodeAutoNoError @(Alpha (AdobeRGB 'NonLinear)) @Word16 f+      specEncodeDecodeAutoNoError @(Alpha (AdobeRGB 'NonLinear)) @Word32 f+      specEncodeDecodeAutoNoError @(Alpha (AdobeRGB 'NonLinear)) @Word64 f+      specEncodeDecodeAutoNoError @(CMYK (AdobeRGB 'NonLinear)) @Word8 f+      specEncodeDecodeAutoNoError @(CMYK (AdobeRGB 'NonLinear)) @Word16 f+      specEncodeDecodeAutoNoError @(CMYK (AdobeRGB 'NonLinear)) @Word32 f+      specEncodeDecodeAutoNoError @(CMYK (AdobeRGB 'NonLinear)) @Word64 f+      -- specEncodeDecodeAutoNoError @(YCbCr (AdobeRGB 'NonLinear)) @Word8 f+      -- specEncodeDecodeAutoNoError @(YCbCr (AdobeRGB 'NonLinear)) @Word16 f+      -- specEncodeDecodeAutoNoError @(YCbCr (AdobeRGB 'NonLinear)) @Word32 f+      -- specEncodeDecodeAutoNoError @(YCbCr (AdobeRGB 'NonLinear)) @Word64 f
tests/Test/Massiv/Array/IO/Image/Common.hs view
@@ -1,8 +1,9 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE AllowAmbiguousTypes #-} module Test.Massiv.Array.IO.Image.Common where  import Data.List.NonEmpty as NE (NonEmpty(..))@@ -13,6 +14,7 @@ import System.Random import Test.Hspec.QuickCheck + elevatorGen :: (Random e, Elevator e) => Gen e elevatorGen = choose (minValue, maxValue) @@ -24,13 +26,13 @@   arbitrary = PixelY <$> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (Y i)) e) where   arbitrary = PixelYA <$> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel SRGB e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (SRGB l) e) where   arbitrary = PixelRGB <$> elevatorGen <*> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha SRGB) e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (SRGB l)) e) where   arbitrary = PixelRGBA <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel AdobeRGB e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (AdobeRGB l) e) where   arbitrary = PixelRGB <$> elevatorGen <*> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha AdobeRGB) e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (AdobeRGB l)) e) where   arbitrary = PixelRGBA <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (YCbCr cs) e) where   arbitrary = PixelYCbCr <$> elevatorGen <*> elevatorGen <*> elevatorGen
tests/Test/Massiv/Array/IO/Image/JuicyPixelsSpec.hs view
@@ -1,8 +1,9 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE AllowAmbiguousTypes #-} module Test.Massiv.Array.IO.Image.JuicyPixelsSpec (spec) where  import Data.Massiv.Array.IO hiding (showsType)@@ -16,26 +17,26 @@       specEncodeNoError @Y' @Word8 BMP       specEncodeNoError @(Y D65) @Word8 BMP       --specEncodeDecodeNoError @(Y D65) @Word8 BMP-      specEncodeDecodeNoError @SRGB @Word8 BMP-      specEncodeDecodeNoError @(Alpha SRGB) @Word8 BMP+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 BMP+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 BMP     describe "GIF" $ do       specEncodeNoError @Y' @Word8 GIF       specEncodeNoError @(Y D65) @Word8 GIF-      specEncodeDecodeNoError @SRGB @Word8 GIF+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 GIF       --specEncodeGifSequenceNoError @(Y D65) @Word8       describe "Sequenece" $ do-        specEncodeDecodeGifSequenceNoError @SRGB @Word8-        specEncodeDecodeGifSequenceNoError @(Alpha SRGB) @Word8+        specEncodeDecodeGifSequenceNoError @(SRGB 'NonLinear) @Word8+        specEncodeDecodeGifSequenceNoError @(Alpha (SRGB 'NonLinear)) @Word8       -- TODO: read RGBA8, write Y8     -- getting 'DecodeError "Invalid sanline size"' with seed=2023820902     -- describe "HDR" $ do-    --   specEncodeDecodeNoError @SRGB @Float HDR+    --   specEncodeDecodeNoError @(SRGB 'NonLinear) @Float HDR     describe "JPG" $ do       specEncodeDecodeNoError @Y' @Word8 JPG       specEncodeDecodeNoError @(Y D65) @Word8 JPG-      specEncodeDecodeNoError @SRGB @Word8 JPG-      specEncodeDecodeNoError @(CMYK SRGB) @Word8 JPG-      specEncodeDecodeNoError @(YCbCr SRGB) @Word8 JPG+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 JPG+      specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word8 JPG+      specEncodeDecodeNoError @(YCbCr (SRGB 'NonLinear)) @Word8 JPG       -- TODO: read YA8     describe "PNG" $ do       specEncodeDecodeNoError @Y' @Word8 PNG@@ -46,15 +47,15 @@       specEncodeDecodeNoError @(Y D65) @Word16 PNG       specEncodeDecodeNoError @(Alpha (Y D65)) @Word8 PNG       specEncodeDecodeNoError @(Alpha (Y D65)) @Word16 PNG-      specEncodeDecodeNoError @SRGB @Word8 PNG-      specEncodeDecodeNoError @SRGB @Word16 PNG-      specEncodeDecodeNoError @(Alpha SRGB) @Word8 PNG-      specEncodeDecodeNoError @(Alpha SRGB) @Word16 PNG+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 PNG+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word16 PNG+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 PNG+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word16 PNG     describe "TGA" $ do       specEncodeDecodeNoError @Y' @Word8 TGA       specEncodeDecodeNoError @(Y D65) @Word8 TGA-      specEncodeDecodeNoError @SRGB @Word8 TGA-      specEncodeDecodeNoError @(Alpha SRGB) @Word8 TGA+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 TGA+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 TGA     describe "TIF" $ do       specEncodeDecodeNoError @Y' @Word8 TIF       specEncodeDecodeNoError @Y' @Word16 TIF@@ -68,10 +69,10 @@       specEncodeDecodeNoError @(Alpha Y') @Word16 TIF       specEncodeDecodeNoError @(Alpha (Y D65)) @Word8 TIF       specEncodeDecodeNoError @(Alpha (Y D65)) @Word16 TIF-      specEncodeDecodeNoError @SRGB @Word8 TIF-      specEncodeDecodeNoError @SRGB @Word16 TIF-      specEncodeDecodeNoError @(Alpha SRGB) @Word8 TIF-      specEncodeDecodeNoError @(Alpha SRGB) @Word16 TIF-      specEncodeDecodeNoError @(CMYK SRGB) @Word8 TIF-      specEncodeDecodeNoError @(CMYK SRGB) @Word16 TIF-      specEncodeNoError @(YCbCr SRGB) @Word8 TIF+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 TIF+      specEncodeDecodeNoError @(SRGB 'NonLinear) @Word16 TIF+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 TIF+      specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word16 TIF+      specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word8 TIF+      specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word16 TIF+      specEncodeNoError @(YCbCr (SRGB 'NonLinear)) @Word8 TIF
tests/doctests.hs view
@@ -1,12 +1,6 @@ module Main where -import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_) import Test.DocTest (doctest)  main :: IO ()-main = do-    traverse_ putStrLn args-    doctest args-  where-    args = flags ++ pkgs ++ module_sources+main = doctest ["src"]