Color-0.3.3: Color spaces and conversions between them
Copyright(c) Alexey Kuleshevich 2018-2020
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Graphics.Color.Space.RGB.Luma

Contents

Description

 
Synopsis

Luma

pattern Y' :: e -> Color (Y' cs) e Source #

Constructor for Luma Y`. (Not to be confused with luminance Y)

Since: 0.1.0

pattern Y'A :: e -> e -> Color (Alpha (Y' cs)) e Source #

Constructor for Y` with alpha channel. (Not to be confused with luminance Y)

Since: 0.1.4

pattern Luma :: Color X e -> Color (Y' cs) e Source #

data Y' (cs :: Linearity -> Type) Source #

Luma of a non-linear gamma corrected RGB color space. (Not to be confused with luminance Y)

Instances

Instances details
(Typeable cs, Illuminant i, ColorSpace (cs 'Linear) i e, ColorSpace (cs 'NonLinear) i e, Luma cs, RedGreenBlue cs i) => ColorSpace (Y' cs) (i :: k) e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Associated Types

type BaseModel (Y' cs) Source #

type BaseSpace (Y' cs) Source #

Methods

toBaseModel :: Color (Y' cs) e -> Color (BaseModel (Y' cs)) e Source #

fromBaseModel :: Color (BaseModel (Y' cs)) e -> Color (Y' cs) e Source #

toBaseSpace :: Color (Y' cs) e -> Color (BaseSpace (Y' cs)) e Source #

fromBaseSpace :: Color (BaseSpace (Y' cs)) e -> Color (Y' cs) e Source #

luminance :: (Elevator a, RealFloat a) => Color (Y' cs) e -> Color (Y i) a Source #

toColorXYZ :: (Elevator a, RealFloat a) => Color (Y' cs) e -> Color (XYZ i) a Source #

fromColorXYZ :: (Elevator a, RealFloat a) => Color (XYZ i) a -> Color (Y' cs) e Source #

Functor (Color (Y' cs)) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

fmap :: (a -> b) -> Color (Y' cs) a -> Color (Y' cs) b #

(<$) :: a -> Color (Y' cs) b -> Color (Y' cs) a #

Applicative (Color (Y' cs)) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

pure :: a -> Color (Y' cs) a #

(<*>) :: Color (Y' cs) (a -> b) -> Color (Y' cs) a -> Color (Y' cs) b #

liftA2 :: (a -> b -> c) -> Color (Y' cs) a -> Color (Y' cs) b -> Color (Y' cs) c #

(*>) :: Color (Y' cs) a -> Color (Y' cs) b -> Color (Y' cs) b #

(<*) :: Color (Y' cs) a -> Color (Y' cs) b -> Color (Y' cs) a #

Foldable (Color (Y' cs)) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

fold :: Monoid m => Color (Y' cs) m -> m #

foldMap :: Monoid m => (a -> m) -> Color (Y' cs) a -> m #

foldMap' :: Monoid m => (a -> m) -> Color (Y' cs) a -> m #

foldr :: (a -> b -> b) -> b -> Color (Y' cs) a -> b #

foldr' :: (a -> b -> b) -> b -> Color (Y' cs) a -> b #

foldl :: (b -> a -> b) -> b -> Color (Y' cs) a -> b #

foldl' :: (b -> a -> b) -> b -> Color (Y' cs) a -> b #

foldr1 :: (a -> a -> a) -> Color (Y' cs) a -> a #

foldl1 :: (a -> a -> a) -> Color (Y' cs) a -> a #

toList :: Color (Y' cs) a -> [a] #

null :: Color (Y' cs) a -> Bool #

length :: Color (Y' cs) a -> Int #

elem :: Eq a => a -> Color (Y' cs) a -> Bool #

maximum :: Ord a => Color (Y' cs) a -> a #

minimum :: Ord a => Color (Y' cs) a -> a #

sum :: Num a => Color (Y' cs) a -> a #

product :: Num a => Color (Y' cs) a -> a #

Traversable (Color (Y' cs)) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

traverse :: Applicative f => (a -> f b) -> Color (Y' cs) a -> f (Color (Y' cs) b) #

sequenceA :: Applicative f => Color (Y' cs) (f a) -> f (Color (Y' cs) a) #

mapM :: Monad m => (a -> m b) -> Color (Y' cs) a -> m (Color (Y' cs) b) #

sequence :: Monad m => Color (Y' cs) (m a) -> m (Color (Y' cs) a) #

(Typeable cs, Elevator e) => ColorModel (Y' cs) e Source #

Y` - as a color model

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Associated Types

type Components (Y' cs) e Source #

Eq e => Eq (Color (Y' cs) e) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

(==) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

(/=) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

Ord e => Ord (Color (Y' cs) e) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

compare :: Color (Y' cs) e -> Color (Y' cs) e -> Ordering #

(<) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

(<=) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

(>) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

(>=) :: Color (Y' cs) e -> Color (Y' cs) e -> Bool #

max :: Color (Y' cs) e -> Color (Y' cs) e -> Color (Y' cs) e #

min :: Color (Y' cs) e -> Color (Y' cs) e -> Color (Y' cs) e #

(Typeable cs, Elevator e) => Show (Color (Y' cs) e) Source #

Y` - as a color model

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

showsPrec :: Int -> Color (Y' cs) e -> ShowS #

show :: Color (Y' cs) e -> String #

showList :: [Color (Y' cs) e] -> ShowS #

Storable e => Storable (Color (Y' cs) e) Source #

Y` - luma of a color space

Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

sizeOf :: Color (Y' cs) e -> Int #

alignment :: Color (Y' cs) e -> Int #

peekElemOff :: Ptr (Color (Y' cs) e) -> Int -> IO (Color (Y' cs) e) #

pokeElemOff :: Ptr (Color (Y' cs) e) -> Int -> Color (Y' cs) e -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Color (Y' cs) e) #

pokeByteOff :: Ptr b -> Int -> Color (Y' cs) e -> IO () #

peek :: Ptr (Color (Y' cs) e) -> IO (Color (Y' cs) e) #

poke :: Ptr (Color (Y' cs) e) -> Color (Y' cs) e -> IO () #

newtype Color (Y' cs) e Source #

Constructor for Luma.

Instance details

Defined in Graphics.Color.Space.RGB.Luma

newtype Color (Y' cs) e = Luma (Color X e)
type BaseModel (Y' cs) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

type BaseModel (Y' cs) = X
type BaseSpace (Y' cs) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

type BaseSpace (Y' cs) = cs 'NonLinear
type Components (Y' cs) e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

type Components (Y' cs) e = e

class Luma (cs :: Linearity -> Type) where Source #

Minimal complete definition

rWeight, gWeight | rWeight, bWeight | gWeight, bWeight

Methods

rWeight :: RealFloat e => Weight cs e Source #

gWeight :: RealFloat e => Weight cs e Source #

bWeight :: RealFloat e => Weight cs e Source #

newtype Weight cs e Source #

Constructors

Weight 

Fields

Instances

Instances details
Functor (Weight cs) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

fmap :: (a -> b) -> Weight cs a -> Weight cs b #

(<$) :: a -> Weight cs b -> Weight cs a #

Eq e => Eq (Weight cs e) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

(==) :: Weight cs e -> Weight cs e -> Bool #

(/=) :: Weight cs e -> Weight cs e -> Bool #

Floating e => Floating (Weight cs e) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

pi :: Weight cs e #

exp :: Weight cs e -> Weight cs e #

log :: Weight cs e -> Weight cs e #

sqrt :: Weight cs e -> Weight cs e #

(**) :: Weight cs e -> Weight cs e -> Weight cs e #

logBase :: Weight cs e -> Weight cs e -> Weight cs e #

sin :: Weight cs e -> Weight cs e #

cos :: Weight cs e -> Weight cs e #

tan :: Weight cs e -> Weight cs e #

asin :: Weight cs e -> Weight cs e #

acos :: Weight cs e -> Weight cs e #

atan :: Weight cs e -> Weight cs e #

sinh :: Weight cs e -> Weight cs e #

cosh :: Weight cs e -> Weight cs e #

tanh :: Weight cs e -> Weight cs e #

asinh :: Weight cs e -> Weight cs e #

acosh :: Weight cs e -> Weight cs e #

atanh :: Weight cs e -> Weight cs e #

log1p :: Weight cs e -> Weight cs e #

expm1 :: Weight cs e -> Weight cs e #

log1pexp :: Weight cs e -> Weight cs e #

log1mexp :: Weight cs e -> Weight cs e #

Fractional e => Fractional (Weight cs e) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

(/) :: Weight cs e -> Weight cs e -> Weight cs e #

recip :: Weight cs e -> Weight cs e #

fromRational :: Rational -> Weight cs e #

Num e => Num (Weight cs e) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

(+) :: Weight cs e -> Weight cs e -> Weight cs e #

(-) :: Weight cs e -> Weight cs e -> Weight cs e #

(*) :: Weight cs e -> Weight cs e -> Weight cs e #

negate :: Weight cs e -> Weight cs e #

abs :: Weight cs e -> Weight cs e #

signum :: Weight cs e -> Weight cs e #

fromInteger :: Integer -> Weight cs e #

Show e => Show (Weight cs e) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Luma

Methods

showsPrec :: Int -> Weight cs e -> ShowS #

show :: Weight cs e -> String #

showList :: [Weight cs e] -> ShowS #

newtype Weights e Source #

Weights imposed on individual channels of a 3-component color

Since: 0.1.0

Constructors

Weights 

Fields

Instances

Instances details
Functor Weights Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

fmap :: (a -> b) -> Weights a -> Weights b #

(<$) :: a -> Weights b -> Weights a #

Eq e => Eq (Weights e) Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

(==) :: Weights e -> Weights e -> Bool #

(/=) :: Weights e -> Weights e -> Bool #

Floating e => Floating (Weights e) Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

pi :: Weights e #

exp :: Weights e -> Weights e #

log :: Weights e -> Weights e #

sqrt :: Weights e -> Weights e #

(**) :: Weights e -> Weights e -> Weights e #

logBase :: Weights e -> Weights e -> Weights e #

sin :: Weights e -> Weights e #

cos :: Weights e -> Weights e #

tan :: Weights e -> Weights e #

asin :: Weights e -> Weights e #

acos :: Weights e -> Weights e #

atan :: Weights e -> Weights e #

sinh :: Weights e -> Weights e #

cosh :: Weights e -> Weights e #

tanh :: Weights e -> Weights e #

asinh :: Weights e -> Weights e #

acosh :: Weights e -> Weights e #

atanh :: Weights e -> Weights e #

log1p :: Weights e -> Weights e #

expm1 :: Weights e -> Weights e #

log1pexp :: Weights e -> Weights e #

log1mexp :: Weights e -> Weights e #

Fractional e => Fractional (Weights e) Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

(/) :: Weights e -> Weights e -> Weights e #

recip :: Weights e -> Weights e #

fromRational :: Rational -> Weights e #

Num e => Num (Weights e) Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

(+) :: Weights e -> Weights e -> Weights e #

(-) :: Weights e -> Weights e -> Weights e #

(*) :: Weights e -> Weights e -> Weights e #

negate :: Weights e -> Weights e #

abs :: Weights e -> Weights e #

signum :: Weights e -> Weights e #

fromInteger :: Integer -> Weights e #

Elevator e => Show (Weights e) Source # 
Instance details

Defined in Graphics.Color.Model.X

Methods

showsPrec :: Int -> Weights e -> ShowS #

show :: Weights e -> String #

showList :: [Weights e] -> ShowS #

rgbLuma :: forall cs i e' e. (Luma cs, RedGreenBlue cs i, Elevator e', Elevator e, RealFloat e) => Color (cs 'NonLinear) e' -> Color (Y' cs) e Source #

Convert a non-linear RGB pixel to a luma pixel

Since: 0.1.0

rgbLumaWeights :: forall cs e' e. (Luma cs, RealFloat e) => Color (cs 'NonLinear) e' -> Weights e Source #

Get the weights of a non-linear RGB color space that can be used for converting to Luma

Since: 0.1.4

toBaseLinearSpace :: forall cs e i. (RedGreenBlue cs i, Applicative (Color (cs 'Linear)), RealFloat e) => Color (Y' cs) e -> Color (cs 'Linear) e Source #

Convert Luma directly into the linear version of base space. This is equivalent to `dcctf . toBaseSpace`, but is a bit faster, since inverse transfer function is applied only once

Since: 0.3.0