monomer-1.4.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Monomer.Graphics.Util

Description

Helper functions for graphics related operations.

Synopsis

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.

alignHInRect :: Rect -> Rect -> AlignH -> Rect Source #

Aligns the child rect horizontally inside the parent.

alignVInRect :: Rect -> Rect -> AlignV -> Rect Source #

Aligns the child rect vertically inside the parent.