Safe Haskell | None |
---|
Predefined and custom colors. Essentially equivalent to the Graphics.Gloss.Data.Color, but lifted to Accelerate types.
- type Color = RGBA Float
- data RGBA a = RGBA a a a a
- makeColor :: Exp Float -> Exp Float -> Exp Float -> Exp Float -> Exp Color
- makeColor8 :: Exp Word8 -> Exp Word8 -> Exp Word8 -> Exp Word8 -> Exp Color
- rawColor :: Exp Float -> Exp Float -> Exp Float -> Exp Float -> Exp Color
- rgbaOfColor :: Exp Color -> (Exp Float, Exp Float, Exp Float, Exp Float)
- packRGBA :: Exp Color -> Exp Word32
- packABGR :: Exp Color -> Exp Word32
- clampColor :: Exp Color -> Exp Color
- mixColors :: Exp Float -> Exp Float -> Exp Color -> Exp Color -> Exp Color
- addColors :: Exp Color -> Exp Color -> Exp Color
- dim :: Exp Color -> Exp Color
- brighten :: Exp Color -> Exp Color
- lighten :: Exp Color -> Exp Color
- darken :: Exp Color -> Exp Color
- opaque :: Exp Color -> Exp Color
- greyN :: Exp Float -> Exp Color
- black :: Exp Color
- white :: Exp Color
- red :: Exp Color
- green :: Exp Color
- blue :: Exp Color
- yellow :: Exp Color
- cyan :: Exp Color
- magenta :: Exp Color
- rose :: Exp Color
- violet :: Exp Color
- azure :: Exp Color
- aquamarine :: Exp Color
- chartreuse :: Exp Color
- orange :: Exp Color
Color data type
An abstract color value.
We keep the type abstract so we can be sure that the components are in the
required range. To make a custom color use makeColor
.
An RGBA colour value to hold the color components. All components lie in the range [0..1).
We need to parameterise by a type so that we can have both Exp (RGBA a) and RGBA (Exp a).
RGBA a a a a |
:: Exp Float | Red component. |
-> Exp Float | Green component. |
-> Exp Float | Blue component. |
-> Exp Float | Alpha component. |
-> Exp Color |
Make a custom color. All components are clamped to the range [0..1].
:: Exp Word8 | Red component. |
-> Exp Word8 | Green component. |
-> Exp Word8 | Blue component. |
-> Exp Word8 | Alpha component. |
-> Exp Color |
Make a custom color from 8-bit values.
rawColor :: Exp Float -> Exp Float -> Exp Float -> Exp Float -> Exp ColorSource
Make a custom color. You promise that all components are clamped to the range [0..1]
rgbaOfColor :: Exp Color -> (Exp Float, Exp Float, Exp Float, Exp Float)Source
Take the RGBA components of a color.
packABGR :: Exp Color -> Exp Word32Source
Convert a colour into a packed BGRA value.
This is necessary as OpenGL reads pixel data as ABGR, rather than RGBA.
Color functions
:: Exp Float | Ratio of first color. |
-> Exp Float | Ratio of second color. |
-> Exp Color | First color. |
-> Exp Color | Second color. |
-> Exp Color | Resulting color. |
Mix two colors with the given ratios.
addColors :: Exp Color -> Exp Color -> Exp ColorSource
Add RGB components of a color component-wise, then normalise them to the highest resulting one. The alpha components are averaged.
Pre-defined colors
A greyness of a given magnitude.