Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Helper functions for graphics related operations.
Synopsis
- clampChannel :: Int -> Int
- clampAlpha :: Double -> Double
- rgb :: Int -> Int -> Int -> Color
- rgba :: Int -> Int -> Int -> Double -> Color
- rgbHex :: String -> Color
- rgbaHex :: String -> Double -> Color
- hsl :: Int -> Int -> Int -> Color
- hsla :: Int -> Int -> Int -> Double -> Color
- colorToHsl :: Color -> (Int, Int, Int)
- rgbToHsl :: Int -> Int -> Int -> (Int, Int, Int)
- transparent :: Color
- alignInRect :: Rect -> Rect -> AlignH -> AlignV -> Rect
- alignHInRect :: Rect -> Rect -> AlignH -> Rect
- alignVInRect :: Rect -> Rect -> AlignV -> Rect
Documentation
clampChannel :: Int -> Int Source #
Restricts a color channel to its valid range.
clampAlpha :: Double -> Double Source #
Restricts an alpha channel to its valid range.
rgb :: Int -> Int -> Int -> Color Source #
Creates a Color from red, green and blue components. Valid range for each component is [0, 255].
rgba :: Int -> Int -> Int -> Double -> Color Source #
Creates a Color from red, green and blue components plus alpha channel. Valid range for each component is [0, 255], while alpha is [0, 1].
rgbHex :: String -> Color Source #
Creates a Color from a hex string. It may include a # prefix or not.
rgbaHex :: String -> Double -> Color Source #
Creates a Color from a hex string plus an alpha component. It may include a # prefix or not.
hsl :: Int -> Int -> Int -> Color Source #
Creates a Color instance from HSL components. The valid ranges are:
- Hue: [0, 360]
- Saturation: [0, 100]
- Lightness: [0, 100]
Alpha is set to 1.0.
hsla :: Int -> Int -> Int -> Double -> Color Source #
Creates a Color instance from HSL components. The valid ranges are:
- Hue: [0, 360]
- Saturation: [0, 100]
- Lightness: [0, 100]
- Alpha: [0, 1]
colorToHsl :: Color -> (Int, Int, Int) Source #
Converts a Color
instance to a tuple representing HSL values
rgbToHsl :: Int -> Int -> Int -> (Int, Int, Int) Source #
Converts RGB values to a tuple representing HSL values
transparent :: Color Source #
Creates a non visible color.
alignInRect :: Rect -> Rect -> AlignH -> AlignV -> Rect Source #
Aligns the child rect inside the parent given the alignment constraints.
Note: The child rect can overflow the parent.