Cogl.Color¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
private_member_alpha |
r |
||
private_member_blue |
r |
||
private_member_green |
r |
||
private_member_padding0 |
r |
||
private_member_padding1 |
r |
||
private_member_padding2 |
r |
||
private_member_red |
r |
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Cogl.Color¶
A structure for holding a color definition. The contents of the
Cogl.Color
structure are private and should never by accessed directly.New in version 1.0.
- classmethod equal(v1, v2)¶
- Parameters:
v1 (
object
orNone
) – aCogl.Color
v2 (
object
orNone
) – aCogl.Color
- Returns:
True
if the two colors are the same.- Return type:
Compares two
Cogl.Color
s and checks if they are the same.This function can be passed to g_hash_table_new() as the key_equal_func parameter, when using
Cogl.Color
s as keys in aGLib.HashTable
.New in version 1.0.
- classmethod init_from_hsl(hue, saturation, luminance)¶
- Parameters:
- Returns:
return location for a
Cogl.Color
- Return type:
color:
Cogl.Color
Converts a color expressed in HLS (hue, luminance and saturation) values into a
Cogl.Color
.New in version 1.16.
- classmethod new()¶
- Returns:
a newly-allocated
Cogl.Color
. UseCogl.Color.free
() to free the allocated resources- Return type:
Creates a new (empty) color
New in version 1.0.
- copy()¶
- Returns:
a newly-allocated
Cogl.Color
. UseCogl.Color.free
() to free the allocate resources- Return type:
Creates a copy of self
New in version 1.0.
- free()¶
Frees the resources allocated by
Cogl.Color.new
() andCogl.Color.copy
()New in version 1.0.
- get_alpha()¶
- Returns:
the alpha channel of the passed color
- Return type:
Retrieves the alpha channel of self as a fixed point value between 0 and 1.0.
New in version 1.0.
- get_alpha_byte()¶
- Returns:
the alpha channel of the passed color
- Return type:
Retrieves the alpha channel of self as a byte value between 0 and 255
New in version 1.0.
- get_alpha_float()¶
- Returns:
the alpha channel of the passed color
- Return type:
Retrieves the alpha channel of self as a floating point value between 0.0 and 1.0
New in version 1.0.
- get_blue()¶
- Returns:
the blue channel of the passed color
- Return type:
Retrieves the blue channel of self as a fixed point value between 0 and 1.0.
New in version 1.0.
- get_blue_byte()¶
- Returns:
the blue channel of the passed color
- Return type:
Retrieves the blue channel of self as a byte value between 0 and 255
New in version 1.0.
- get_blue_float()¶
- Returns:
the blue channel of the passed color
- Return type:
Retrieves the blue channel of self as a floating point value between 0.0 and 1.0
New in version 1.0.
- get_green()¶
- Returns:
the green channel of the passed color
- Return type:
Retrieves the green channel of self as a fixed point value between 0 and 1.0.
New in version 1.0.
- get_green_byte()¶
- Returns:
the green channel of the passed color
- Return type:
Retrieves the green channel of self as a byte value between 0 and 255
New in version 1.0.
- get_green_float()¶
- Returns:
the green channel of the passed color
- Return type:
Retrieves the green channel of self as a floating point value between 0.0 and 1.0
New in version 1.0.
- get_red()¶
- Returns:
the red channel of the passed color
- Return type:
Retrieves the red channel of self as a fixed point value between 0 and 1.0.
New in version 1.0.
- get_red_byte()¶
- Returns:
the red channel of the passed color
- Return type:
Retrieves the red channel of self as a byte value between 0 and 255
New in version 1.0.
- get_red_float()¶
- Returns:
the red channel of the passed color
- Return type:
Retrieves the red channel of self as a floating point value between 0.0 and 1.0
New in version 1.0.
- init_from_4f(red, green, blue, alpha)¶
- Parameters:
Sets the values of the passed channels into a
Cogl.Color
New in version 1.4.
- init_from_4fv(color_array)¶
- Parameters:
color_array (
float
) – a pointer to an array of 4 float color components
Sets the values of the passed channels into a
Cogl.Color
New in version 1.4.
- init_from_4ub(red, green, blue, alpha)¶
- Parameters:
Sets the values of the passed channels into a
Cogl.Color
.New in version 1.4.
- premultiply()¶
Converts a non-premultiplied color to a pre-multiplied color. For example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied and (0.5, 0, 0, 0.5) when premultiplied.
New in version 1.0.
- set_alpha(alpha)¶
- Parameters:
alpha (
float
) – a float value between 0.0f and 1.0f
Sets the alpha channel of self to alpha.
New in version 1.4.
- set_alpha_byte(alpha)¶
- Parameters:
alpha (
int
) – a byte value between 0 and 255
Sets the alpha channel of self to alpha.
New in version 1.4.
- set_alpha_float(alpha)¶
- Parameters:
alpha (
float
) – a float value between 0.0f and 1.0f
Sets the alpha channel of self to alpha.
New in version 1.4.
- set_blue(blue)¶
- Parameters:
blue (
float
) – a float value between 0.0f and 1.0f
Sets the blue channel of self to blue.
New in version 1.4.
- set_blue_byte(blue)¶
- Parameters:
blue (
int
) – a byte value between 0 and 255
Sets the blue channel of self to blue.
New in version 1.4.
- set_blue_float(blue)¶
- Parameters:
blue (
float
) – a float value between 0.0f and 1.0f
Sets the blue channel of self to blue.
New in version 1.4.
- set_from_4f(red, green, blue, alpha)¶
- Parameters:
Sets the values of the passed channels into a
Cogl.Color
New in version 1.0.
Deprecated since version 1.4: Use
Cogl.Color.init_from_4f
instead.
- set_from_4ub(red, green, blue, alpha)¶
- Parameters:
Sets the values of the passed channels into a
Cogl.Color
.New in version 1.0.
Deprecated since version 1.4: Use
Cogl.Color.init_from_4ub
instead.
- set_green(green)¶
- Parameters:
green (
float
) – a float value between 0.0f and 1.0f
Sets the green channel of self to green.
New in version 1.4.
- set_green_byte(green)¶
- Parameters:
green (
int
) – a byte value between 0 and 255
Sets the green channel of self to green.
New in version 1.4.
- set_green_float(green)¶
- Parameters:
green (
float
) – a float value between 0.0f and 1.0f
Sets the green channel of self to green.
New in version 1.4.
- set_red(red)¶
- Parameters:
red (
float
) – a float value between 0.0f and 1.0f
Sets the red channel of self to red.
New in version 1.4.
- set_red_byte(red)¶
- Parameters:
red (
int
) – a byte value between 0 and 255
Sets the red channel of self to red.
New in version 1.4.
- set_red_float(red)¶
- Parameters:
red (
float
) – a float value between 0.0f and 1.0f
Sets the red channel of self to red.
New in version 1.4.
- to_hsl()¶
- Returns:
- Return type:
Converts self to the HLS format.
The hue value is in the 0 .. 360 range. The luminance and saturation values are in the 0 .. 1 range.
New in version 1.16.
- unpremultiply()¶
Converts a pre-multiplied color to a non-premultiplied color. For example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied and (1.0, 0, 0, 0.5) when non-premultiplied.
New in version 1.4.