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

Graphics.Pixel

Contents

Description

 
Synopsis

Documentation

newtype Pixel cs e Source #

Digital imaging is one of the most common places for a color to be used in. The smallest element in any image is a pixel, which is defined by its color.

Since: 0.1.0

Constructors

Pixel (Color cs e) 

Bundled Patterns

pattern PixelX :: e -> Pixel X e

Constructor for a grayscale pixel with single channel.

Since: 0.1.0

pattern PixelRGB :: e -> e -> e -> Pixel RGB e

Constructor for a pixel with RGB color model.

Since: 0.1.0

pattern PixelHSI :: e -> e -> e -> Pixel HSI e

Constructor for Pixel with HSI color model.

Since: 0.1.0

pattern PixelHSL :: e -> e -> e -> Pixel HSL e

Constructor for Pixel with HSL color model.

Since: 0.1.0

pattern PixelHSV :: e -> e -> e -> Pixel HSV e

Constructor for Pixel with HSV color model.

Since: 0.1.0

pattern PixelCMYK :: e -> e -> e -> e -> Pixel CMYK e

Constructor for a pixel with CMYK color model.

Since: 0.1.0

pattern PixelYCbCr :: e -> e -> e -> Pixel YCbCr e

Constructor for a pixel with YCbCr color model.

Since: 0.1.0

pattern PixelXA :: e -> e -> Pixel (Alpha X) e

Constructor for a grayscale pixel with a transparency channel.

Since: 0.1.0

pattern PixelRGBA :: e -> e -> e -> e -> Pixel (Alpha RGB) e

Constructor for a pixel with RGB color model and Alpha channel.

Since: 0.1.0

pattern PixelHSIA :: e -> e -> e -> e -> Pixel (Alpha HSI) e

Constructor for a pixel with HSI color model and Alpha channel.

Since: 0.1.0

pattern PixelHSLA :: e -> e -> e -> e -> Pixel (Alpha HSL) e

Constructor for a pixel with HSL color model and Alpha channel.

Since: 0.1.0

pattern PixelHSVA :: e -> e -> e -> e -> Pixel (Alpha HSV) e

Constructor for a pixel with HSV color model and Alpha channel.

Since: 0.1.0

pattern PixelCMYKA :: e -> e -> e -> e -> e -> Pixel (Alpha CMYK) e

Constructor for a pixel with CMYK color model and Alpha channel.

Since: 0.1.0

pattern PixelYCbCrA :: e -> e -> e -> e -> Pixel (Alpha YCbCr) e

Constructor for a pixel with YCbCr color model and Alpha channel.

Since: 0.1.0

Instances

Instances details
ColorModel cs e => Vector Vector (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Pixel cs e) -> m (Vector (Pixel cs e)) #

basicUnsafeThaw :: PrimMonad m => Vector (Pixel cs e) -> m (Mutable Vector (PrimState m) (Pixel cs e)) #

basicLength :: Vector (Pixel cs e) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (Pixel cs e) -> Vector (Pixel cs e) #

basicUnsafeIndexM :: Monad m => Vector (Pixel cs e) -> Int -> m (Pixel cs e) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Pixel cs e) -> Vector (Pixel cs e) -> m () #

elemseq :: Vector (Pixel cs e) -> Pixel cs e -> b -> b #

ColorModel cs e => MVector MVector (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

basicLength :: MVector s (Pixel cs e) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (Pixel cs e) -> MVector s (Pixel cs e) #

basicOverlaps :: MVector s (Pixel cs e) -> MVector s (Pixel cs e) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Pixel cs e)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> Pixel cs e -> m (MVector (PrimState m) (Pixel cs e)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> Int -> m (Pixel cs e) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> Int -> Pixel cs e -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> Pixel cs e -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> MVector (PrimState m) (Pixel cs e) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> MVector (PrimState m) (Pixel cs e) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Pixel cs e) -> Int -> m (MVector (PrimState m) (Pixel cs e)) #

Functor (Color cs) => Functor (Pixel cs) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

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

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

Applicative (Color cs) => Applicative (Pixel cs) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

pure :: a -> Pixel cs a #

(<*>) :: Pixel cs (a -> b) -> Pixel cs a -> Pixel cs b #

liftA2 :: (a -> b -> c) -> Pixel cs a -> Pixel cs b -> Pixel cs c #

(*>) :: Pixel cs a -> Pixel cs b -> Pixel cs b #

(<*) :: Pixel cs a -> Pixel cs b -> Pixel cs a #

Foldable (Color cs) => Foldable (Pixel cs) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

fold :: Monoid m => Pixel cs m -> m #

foldMap :: Monoid m => (a -> m) -> Pixel cs a -> m #

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

foldr :: (a -> b -> b) -> b -> Pixel cs a -> b #

foldr' :: (a -> b -> b) -> b -> Pixel cs a -> b #

foldl :: (b -> a -> b) -> b -> Pixel cs a -> b #

foldl' :: (b -> a -> b) -> b -> Pixel cs a -> b #

foldr1 :: (a -> a -> a) -> Pixel cs a -> a #

foldl1 :: (a -> a -> a) -> Pixel cs a -> a #

toList :: Pixel cs a -> [a] #

null :: Pixel cs a -> Bool #

length :: Pixel cs a -> Int #

elem :: Eq a => a -> Pixel cs a -> Bool #

maximum :: Ord a => Pixel cs a -> a #

minimum :: Ord a => Pixel cs a -> a #

sum :: Num a => Pixel cs a -> a #

product :: Num a => Pixel cs a -> a #

Traversable (Color cs) => Traversable (Pixel cs) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

traverse :: Applicative f => (a -> f b) -> Pixel cs a -> f (Pixel cs b) #

sequenceA :: Applicative f => Pixel cs (f a) -> f (Pixel cs a) #

mapM :: Monad m => (a -> m b) -> Pixel cs a -> m (Pixel cs b) #

sequence :: Monad m => Pixel cs (m a) -> m (Pixel cs a) #

Bounded (Color cs e) => Bounded (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

minBound :: Pixel cs e #

maxBound :: Pixel cs e #

Eq (Color cs e) => Eq (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

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

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

Floating (Color cs e) => Floating (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

pi :: Pixel cs e #

exp :: Pixel cs e -> Pixel cs e #

log :: Pixel cs e -> Pixel cs e #

sqrt :: Pixel cs e -> Pixel cs e #

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

logBase :: Pixel cs e -> Pixel cs e -> Pixel cs e #

sin :: Pixel cs e -> Pixel cs e #

cos :: Pixel cs e -> Pixel cs e #

tan :: Pixel cs e -> Pixel cs e #

asin :: Pixel cs e -> Pixel cs e #

acos :: Pixel cs e -> Pixel cs e #

atan :: Pixel cs e -> Pixel cs e #

sinh :: Pixel cs e -> Pixel cs e #

cosh :: Pixel cs e -> Pixel cs e #

tanh :: Pixel cs e -> Pixel cs e #

asinh :: Pixel cs e -> Pixel cs e #

acosh :: Pixel cs e -> Pixel cs e #

atanh :: Pixel cs e -> Pixel cs e #

log1p :: Pixel cs e -> Pixel cs e #

expm1 :: Pixel cs e -> Pixel cs e #

log1pexp :: Pixel cs e -> Pixel cs e #

log1mexp :: Pixel cs e -> Pixel cs e #

Fractional (Color cs e) => Fractional (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

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

recip :: Pixel cs e -> Pixel cs e #

fromRational :: Rational -> Pixel cs e #

Num (Color cs e) => Num (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

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

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

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

negate :: Pixel cs e -> Pixel cs e #

abs :: Pixel cs e -> Pixel cs e #

signum :: Pixel cs e -> Pixel cs e #

fromInteger :: Integer -> Pixel cs e #

Ord (Color cs e) => Ord (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

compare :: Pixel cs e -> Pixel cs e -> Ordering #

(<) :: Pixel cs e -> Pixel cs e -> Bool #

(<=) :: Pixel cs e -> Pixel cs e -> Bool #

(>) :: Pixel cs e -> Pixel cs e -> Bool #

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

max :: Pixel cs e -> Pixel cs e -> Pixel cs e #

min :: Pixel cs e -> Pixel cs e -> Pixel cs e #

Show (Color cs e) => Show (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

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

show :: Pixel cs e -> String #

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

Storable (Color cs e) => Storable (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

sizeOf :: Pixel cs e -> Int #

alignment :: Pixel cs e -> Int #

peekElemOff :: Ptr (Pixel cs e) -> Int -> IO (Pixel cs e) #

pokeElemOff :: Ptr (Pixel cs e) -> Int -> Pixel cs e -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Pixel cs e) #

pokeByteOff :: Ptr b -> Int -> Pixel cs e -> IO () #

peek :: Ptr (Pixel cs e) -> IO (Pixel cs e) #

poke :: Ptr (Pixel cs e) -> Pixel cs e -> IO () #

Default (Color cs e) => Default (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

def :: Pixel cs e #

NFData (Color cs e) => NFData (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

Methods

rnf :: Pixel cs e -> () #

ColorModel cs e => Unbox (Pixel cs e) Source #

Unboxing of a Pixel.

Instance details

Defined in Graphics.Pixel.Internal

newtype MVector s (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

newtype MVector s (Pixel cs e) = MV_Pixel (MVector s (Components cs e))
newtype Vector (Pixel cs e) Source # 
Instance details

Defined in Graphics.Pixel.Internal

newtype Vector (Pixel cs e) = V_Pixel (Vector (Components cs e))

liftPixel :: (Color cs e -> Color cs' e') -> Pixel cs e -> Pixel cs' e' Source #

Apply a function to Pixel's Color

Since: 0.1.0

pixelColor :: Pixel cs e -> Color cs e Source #

Get to the underlying Color

Since: 0.1.4

Elevation

toPixel8 :: ColorModel cs e => Pixel cs e -> Pixel cs Word8 Source #

Convert all channels of a pixel to 8bits each, while doing appropriate scaling. See Elevator.

Since: 0.1.0

toPixel16 :: ColorModel cs e => Pixel cs e -> Pixel cs Word16 Source #

Convert all channels of a pixel to 16bits each, while appropriate scaling. See Elevator.

Since: 0.1.0

toPixel32 :: ColorModel cs e => Pixel cs e -> Pixel cs Word32 Source #

Convert all channels of a pixel to 32bits each, while doing appropriate scaling. See Elevator.

Since: 0.1.0

toPixel64 :: ColorModel cs e => Pixel cs e -> Pixel cs Word64 Source #

Convert all channels of a pixel to 64bits each, while doing appropriate scaling. See Elevator.

Since: 0.1.0

toPixelF :: ColorModel cs e => Pixel cs e -> Pixel cs Float Source #

Convert all channels of a pixel to 32bit floating point numers each, while doing appropriate scaling. See Elevator.

Since: 0.1.0

toPixelD :: ColorModel cs e => Pixel cs e -> Pixel cs Double Source #

Convert all channels of a pixel to 64bit floating point numers each, while doing appropriate scaling. See Elevator.

Since: 0.1.0