colour-space 0.1.2.0 → 0.1.3.0
raw patch · 2 files changed
+20/−3 lines, 2 filesdep ~manifoldsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: manifolds
API changes (from Hackage documentation)
+ Data.Colour.Manifold: instance Data.Manifold.Atlas.Atlas (Data.Colour.Internal.Colour Math.Manifold.Core.Types.ℝ)
+ Data.Colour.Manifold: instance Data.Manifold.Atlas.Atlas Data.Colour.Manifold.ColourNeedle
+ Data.Colour.Manifold: instance GHC.Classes.Eq Data.Colour.Manifold.ColourNeedle
Files
- colour-space.cabal +2/−2
- src/Data/Colour/Manifold.hs +18/−1
colour-space.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: colour-space-version: 0.1.2.0+version: 0.1.3.0 synopsis: Instances of the manifold-classes for colour types -- description: homepage: https://github.com/leftaroundabout/colour-space@@ -21,7 +21,7 @@ -- other-modules: -- other-extensions: build-depends: base >=4.7 && <5- , manifolds >=0.3.1 && <0.4+ , manifolds >=0.4.1 && <0.5 , constrained-categories , linearmap-category , linear
src/Data/Colour/Manifold.hs view
@@ -7,6 +7,7 @@ module Data.Colour.Manifold (Colour, QuantisedColour(..)) where +import Data.Functor (($>)) import Control.Applicative (empty) import Control.Applicative.Constrained import Control.Arrow.Constrained@@ -14,6 +15,7 @@ import Data.Manifold.PseudoAffine import Data.Manifold.Types+import Data.Manifold.Atlas import Data.Manifold.Riemannian import Data.VectorSpace import Data.AffineSpace@@ -22,6 +24,7 @@ import Data.Colour.SRGB (toSRGB, toSRGB24) import Data.Colour.SRGB.Linear import Data.Colour hiding (AffineSpace)+import Data.Colour.Names import Math.LinearMap.Category import Linear.V3@@ -34,7 +37,7 @@ import Data.Coerce import Data.Type.Coercion -newtype ColourNeedle = ColourNeedle { getRGBNeedle :: RGB ℝ } deriving (Show)+newtype ColourNeedle = ColourNeedle { getRGBNeedle :: RGB ℝ } deriving (Eq, Show) asV3Needle :: ColourNeedle -+> V3 ℝ asV3Needle = LinearFunction $ \(ColourNeedle (RGB r g b)) -> V3 r g b@@ -84,6 +87,8 @@ fzipTensorWith = bilinearFunction $ \f (Tensor (RGB r g b), Tensor (RGB r' g' b')) -> Tensor $ RGB (f $ (r,r')) (f $ (g,g')) (f $ (b,b')) coerceFmapTensorProduct _ Coercion = Coercion+ wellDefinedTensor t@(Tensor (RGB r g b))+ = wellDefinedVector r >> wellDefinedVector g >> wellDefinedVector b $> t instance LinearSpace ColourNeedle where type DualVector ColourNeedle = ColourNeedle@@ -194,6 +199,11 @@ instance PseudoAffine ColourNeedle where ColourNeedle q .-~. ColourNeedle s = pure . ColourNeedle $ liftA2 (-) q s +instance Atlas ColourNeedle where+ type ChartIndex ColourNeedle = ()+ interiorChartReferencePoint _ () = zeroV+ lookupAtlas _ = ()+ instance AffineSpace ColourNeedle where type Diff ColourNeedle = ColourNeedle (.-.) = (.-~!)@@ -247,6 +257,13 @@ $ RGB (lerp r r' η') (lerp g g' η') (lerp b b' η')++instance Atlas (Colour ℝ) where+ type ChartIndex (Colour ℝ) = ()+ chartReferencePoint () = grey+ interiorChartReferencePoint = \_ () -> intGrey+ where Just intGrey = toInterior (grey :: Colour ℝ)+ lookupAtlas _ = () class QuantisedColour c where quantiseColour :: Colour ℝ -> c