gi-clutter-1.0.5: clutter GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Clutter.Structs.Color

Description

Color representation.

Synopsis

Exported types

newtype Color Source #

Memory-managed wrapper type.

Constructors

Color (ManagedPtr Color) 

Instances

Instances details
Eq Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

Methods

(==) :: Color -> Color -> Bool #

(/=) :: Color -> Color -> Bool #

GBoxed Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

ManagedPtrNewtype Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

Methods

toManagedPtr :: Color -> ManagedPtr Color

TypedObject Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

Methods

glibType :: IO GType

HasParentTypes Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

tag ~ 'AttrSet => Constructible Color tag Source # 
Instance details

Defined in GI.Clutter.Structs.Color

Methods

new :: MonadIO m => (ManagedPtr Color -> Color) -> [AttrOp Color tag] -> m Color

IsGValue (Maybe Color) Source #

Convert Color to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Clutter.Structs.Color

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Color -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Color)

type ParentTypes Color Source # 
Instance details

Defined in GI.Clutter.Structs.Color

type ParentTypes Color = '[] :: [Type]

newZeroColor :: MonadIO m => m Color Source #

Construct a Color struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

add, copy, darken, equal, free, hash, init, interpolate, lighten, shade, subtract, toHls, toPixel, toString.

Getters

None.

Setters

None.

add

colorAdd Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

a: a Color

-> Color

b: a Color

-> m Color 

Adds a to b and saves the resulting color inside result.

The alpha channel of result is set as as the maximum value between the alpha channels of a and b.

alloc

colorAlloc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Color

Returns: the newly allocated Color; use colorFree to free its resources

Allocates a new, transparent black Color.

Since: 1.12

copy

colorCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m Color

Returns: an allocated copy of color.

Makes a copy of the color structure. The result must be freed using colorFree.

Since: 0.2

darken

colorDarken Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m Color 

Darkens color by a fixed amount, and saves the changed color in result.

equal

colorEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

v1: a Color

-> Color

v2: a Color

-> m Bool

Returns: True if the two colors are the same.

Compares two Colors and checks if they are the same.

This function can be passed to g_hash_table_new() as the keyEqualFunc parameter, when using Colors as keys in a HashTable.

Since: 0.2

free

colorFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m () 

Frees a color structure created with colorCopy.

Since: 0.2

fromHls

colorFromHls Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Float

hue: hue value, in the 0 .. 360 range

-> Float

luminance: luminance value, in the 0 .. 1 range

-> Float

saturation: saturation value, in the 0 .. 1 range

-> m Color 

Converts a color expressed in HLS (hue, luminance and saturation) values into a Color.

fromPixel

colorFromPixel Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

pixel: a 32 bit packed integer containing a color

-> m Color 

Converts pixel from the packed representation of a four 8 bit channel color to a Color.

fromString

colorFromString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

str: a string specifiying a color

-> m (Bool, Color)

Returns: True if parsing succeeded, and False otherwise

Parses a string definition of a color, filling the Color.red, Color.green, Color.blue and Color.alpha fields of color.

The color is not allocated.

The format of str can be either one of:

  • a standard name (as taken from the X11 rgb.txt file)
  • an hexadecimal value in the form: #rgb, #rrggbb, #rgba, or #rrggbbaa
  • a RGB color in the form: rgb(r, g, b)
  • a RGB color in the form: rgba(r, g, b, a)
  • a HSL color in the form: hsl(h, s, l)
  • a HSL color in the form: hsla(h, s, l, a)

where 'r', 'g', 'b' and 'a' are (respectively) the red, green, blue color intensities and the opacity. The 'h', 's' and 'l' are (respectively) the hue, saturation and luminance values.

In the rgb() and rgba() formats, the 'r', 'g', and 'b' values are either integers between 0 and 255, or percentage values in the range between 0% and 100%; the percentages require the '%' character. The 'a' value, if specified, can only be a floating point value between 0.0 and 1.0.

In the hls() and hlsa() formats, the 'h' value (hue) is an angle between 0 and 360.0 degrees; the 'l' and 's' values (luminance and saturation) are percentage values in the range between 0% and 100%. The 'a' value, if specified, can only be a floating point value between 0.0 and 1.0.

Whitespace inside the definitions is ignored; no leading whitespace is allowed.

If the alpha component is not specified then it is assumed to be set to be fully opaque.

Since: 1.0

getStatic

colorGetStatic Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StaticColor

color: the named global color

-> m Color

Returns: a pointer to a static color; the returned pointer is owned by Clutter and it should never be modified or freed

Retrieves a static color for the given color name

Static colors are created by Clutter and are guaranteed to always be available and valid

Since: 1.6

hash

colorHash Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

v: a Color

-> m Word32

Returns: a hash value corresponding to the color

Converts a Color to a hash value.

This function can be passed to g_hash_table_new() as the hashFunc parameter, when using Colors as keys in a HashTable.

Since: 1.0

init

colorInit Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> Word8

red: red component of the color, between 0 and 255

-> Word8

green: green component of the color, between 0 and 255

-> Word8

blue: blue component of the color, between 0 and 255

-> Word8

alpha: alpha component of the color, between 0 and 255

-> m Color

Returns: the initialized Color

Initializes color with the given values.

Since: 1.12

interpolate

colorInterpolate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

initial: the initial Color

-> Color

final: the final Color

-> Double

progress: the interpolation progress

-> m Color 

Interpolates between initial and final Colors using progress

Since: 1.6

lighten

colorLighten Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m Color 

Lightens color by a fixed amount, and saves the changed color in result.

new

colorNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word8

red: red component of the color, between 0 and 255

-> Word8

green: green component of the color, between 0 and 255

-> Word8

blue: blue component of the color, between 0 and 255

-> Word8

alpha: alpha component of the color, between 0 and 255

-> m Color

Returns: the newly allocated color. Use colorFree when done

Creates a new Color with the given values.

This function is the equivalent of:

 clutter_color_init (clutter_color_alloc (), red, green, blue, alpha);

Since: 0.8

shade

colorShade Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> Double

factor: the shade factor to apply

-> m Color 

Shades color by factor and saves the modified color into result.

subtract

colorSubtract Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

a: a Color

-> Color

b: a Color

-> m Color 

Subtracts b from a and saves the resulting color inside result.

This function assumes that the components of a are greater than the components of b; the result is, otherwise, undefined.

The alpha channel of result is set as the minimum value between the alpha channels of a and b.

toHls

colorToHls Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m (Float, Float, Float) 

Converts color to the HLS format.

The hue value is in the 0 .. 360 range. The luminance and saturation values are in the 0 .. 1 range.

toPixel

colorToPixel Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m Word32

Returns: a packed color

Converts color into a packed 32 bit integer, containing all the four 8 bit channels used by Color.

toString

colorToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Color

color: a Color

-> m Text

Returns: a newly-allocated text string

Returns a textual specification of color in the hexadecimal form <literal>&num;rrggbbaa</literal>, where <literal>r</literal>, <literal>g</literal>, <literal>b</literal> and <literal>a</literal> are hexadecimal digits representing the red, green, blue and alpha components respectively.

Since: 0.2

Properties

alpha

alpha component, between 0 and 255

getColorAlpha :: MonadIO m => Color -> m Word8 Source #

Get the value of the “alpha” field. When overloading is enabled, this is equivalent to

get color #alpha

setColorAlpha :: MonadIO m => Color -> Word8 -> m () Source #

Set the value of the “alpha” field. When overloading is enabled, this is equivalent to

set color [ #alpha := value ]

blue

blue component, between 0 and 255

getColorBlue :: MonadIO m => Color -> m Word8 Source #

Get the value of the “blue” field. When overloading is enabled, this is equivalent to

get color #blue

setColorBlue :: MonadIO m => Color -> Word8 -> m () Source #

Set the value of the “blue” field. When overloading is enabled, this is equivalent to

set color [ #blue := value ]

green

green component, between 0 and 255

getColorGreen :: MonadIO m => Color -> m Word8 Source #

Get the value of the “green” field. When overloading is enabled, this is equivalent to

get color #green

setColorGreen :: MonadIO m => Color -> Word8 -> m () Source #

Set the value of the “green” field. When overloading is enabled, this is equivalent to

set color [ #green := value ]

red

red component, between 0 and 255

getColorRed :: MonadIO m => Color -> m Word8 Source #

Get the value of the “red” field. When overloading is enabled, this is equivalent to

get color #red

setColorRed :: MonadIO m => Color -> Word8 -> m () Source #

Set the value of the “red” field. When overloading is enabled, this is equivalent to

set color [ #red := value ]