Skip to content

Commit

Permalink
Remove RealFloat constraint from ColorSpace for Y
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Mar 12, 2021
1 parent d34d582 commit c89f062
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Color/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for Color

## 0.3.1

* Remove `RealFloat` constraint from `ColorSpace` for `Y'`

## 0.3.0

* Rename `Y` color model into `X` to avoid the annoying name conflict.
Expand Down
7 changes: 3 additions & 4 deletions Color/src/Graphics/Color/Space/RGB/Luma.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,17 @@ instance ( Typeable cs
, ColorSpace (cs 'NonLinear) i e
, Luma cs
, RedGreenBlue cs i
, RealFloat e
) =>
ColorSpace (Y' cs) i e where
type BaseModel (Y' cs) = CM.X
type BaseSpace (Y' cs) = cs 'NonLinear
toBaseSpace y = pure (coerce y :: e)
{-# INLINE toBaseSpace #-}
fromBaseSpace = rgbLuma
fromBaseSpace = fmap fromDouble . rgbLuma
{-# INLINE fromBaseSpace #-}
luminance = luminance . toBaseLinearSpace
luminance = luminance . fmap (fromDouble :: Double -> e) . toBaseLinearSpace . fmap toDouble
{-# INLINE luminance #-}
toColorXYZ = toColorXYZ . toBaseLinearSpace
toColorXYZ = toColorXYZ . fmap (fromDouble :: Double -> e) . toBaseLinearSpace . fmap toDouble
{-# INLINE toColorXYZ #-}

-- | Convert Luma directly into the linear version of base space. This is equivalent to
Expand Down

0 comments on commit c89f062

Please sign in to comment.