Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Utilities for converting pixel color values.

NOTE: These functions are not polymorphic in the Float type because without assisatance, GHC does a bad job of converting Word8s to and from floats.

## Synopsis

- floatRmsOfRGB8 :: (Word8, Word8, Word8) -> Float
- doubleRmsOfRGB8 :: (Word8, Word8, Word8) -> Float
- floatLuminanceOfRGB8 :: (Word8, Word8, Word8) -> Float
- doubleLuminanceOfRGB8 :: (Word8, Word8, Word8) -> Double
- rgb8OfGreyFloat :: Float -> (Word8, Word8, Word8)
- rgb8OfGreyDouble :: Double -> (Word8, Word8, Word8)
- rgb8OfFloat :: (Float, Float, Float) -> (Word8, Word8, Word8)
- rgb8OfDouble :: (Double, Double, Double) -> (Word8, Word8, Word8)

# Documentation

floatRmsOfRGB8 :: (Word8, Word8, Word8) -> Float Source #

Compute the root mean square of an RGB color. Result is in the range [0..1].

doubleRmsOfRGB8 :: (Word8, Word8, Word8) -> Float Source #

Compute the root mean square of an RGB color. Result is in the range [0..1].

floatLuminanceOfRGB8 :: (Word8, Word8, Word8) -> Float Source #

Convert an RGB color to its luminance value. Result in the range [0..1].

doubleLuminanceOfRGB8 :: (Word8, Word8, Word8) -> Double Source #

Convert an RGB color to its luminance value. Result in the range [0..1].

rgb8OfGreyFloat :: Float -> (Word8, Word8, Word8) Source #

Promote a value in the range [0..1] to a grey RGB8 color.

rgb8OfGreyDouble :: Double -> (Word8, Word8, Word8) Source #

Promote a value in the range [0..1] to a grey RGB8 color.