Chemical Data Processing Library Python API - Version 1.1.1
|
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparency. More...
Public Member Functions | |
None | __init__ () |
Constructs and initializes a Color object with all RGBA components set to zero. | |
None | __init__ (Color color) |
Initializes a copy of the Color instance color. More... | |
None | __init__ (float red, float green, float blue, float alpha=1.0) |
Constructs and initializes a Color object with the RGBA components set to the specified values. More... | |
int | getObjectID () |
Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
Color | assign (Color color) |
Replaces the current state of self with a copy of the state of the Color instance color. More... | |
float | getAlpha () |
Returns the value of the alpha component. More... | |
None | setAlpha (float alpha) |
Sets the value of the alpha component to alpha. More... | |
float | getBlue () |
Returns the value of the blue color component. More... | |
None | setBlue (float blue) |
Sets the value of the blue color component to blue. More... | |
float | getGreen () |
Returns the value of the green color component. More... | |
None | setGreen (float green) |
Sets the the value of green color component to green. More... | |
float | getRed () |
Returns the value of the red color component. More... | |
None | setRed (float red) |
Sets the value of the red color component to red. More... | |
None | setRGBA (float red, float green, float blue, float alpha=1.0) |
Sets the values of the RGBA components to specified values. More... | |
bool | __eq__ (Color color) |
Equality comparison operator. More... | |
bool | __ne__ (Color color) |
Inequality comparison operator. More... | |
str | __str__ () |
Returns a string representation of the Color instance. More... | |
Static Public Attributes | |
BLACK = Color(r=0, g=0, b=0) | |
A preinitialized Color instance for the color black. | |
BLUE = Color(r=0, g=0, b=1) | |
A preinitialized Color instance for the color blue. | |
CYAN = Color(r=0, g=1, b=1) | |
A preinitialized Color instance for the color cyan. | |
DARK_BLUE = Color(r=0, g=0, b=0.5) | |
A preinitialized Color instance for the color dark blue. | |
DARK_CYAN = Color(r=0, g=0.5, b=0.5) | |
A preinitialized Color instance for the color dark cyan. | |
DARK_GRAY = Color(r=0.5, g=0.5, b=0.5) | |
A preinitialized Color instance for the color dark gray. | |
DARK_GREEN = Color(r=0, g=0.5, b=0) | |
A preinitialized Color instance for the color dark green. | |
DARK_MAGENTA = Color(r=0.5, g=0, b=0.5) | |
A preinitialized Color instance for the color dark magenta. | |
DARK_RED = Color(r=0.5, g=0, b=0) | |
A preinitialized Color instance for the color dark red. | |
DARK_YELLOW = Color(r=0.5, g=0.5, b=0) | |
A preinitialized Color instance for the color dark yellow. | |
GRAY = Color(r=0.625, g=0.625, b=0.625) | |
A preinitialized Color instance for the color gray. | |
GREEN = Color(r=0, g=1, b=0) | |
A preinitialized Color instance for the color green. | |
LIGHT_GRAY = Color(r=0.75, g=0.75, b=0.75) | |
A preinitialized Color instance for the color light gray. | |
MAGENTA = Color(r=1, g=0, b=1) | |
A preinitialized Color instance for the color magenta. | |
RED = Color(r=1, g=0, b=0) | |
A preinitialized Color instance for the color red. | |
TRANSPARENT = Color() | |
A preinitialized Color instance for a totally transparent (alpha = 0) black. | |
WHITE = Color(r=1, g=1, b=1) | |
A preinitialized Color instance for the color white. | |
YELLOW = Color(r=1, g=1, b=0) | |
A preinitialized Color instance for the color yellow. | |
Properties | |
objectID = property(getObjectID) | |
red = property(getRed, setRed) | |
green = property(getGreen, setGreen) | |
blue = property(getBlue, setBlue) | |
alpha = property(getAlpha, setAlpha) | |
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparency.
Each component of the RGBA quadruplet is represented by a double precision floating-point value in the interval [0, 1], where 0 corresponds to the lowest (zero) intensity of a color component and the value 1 represents the highest intensity. Likewise, a value of 1 for the alpha-channel corresponds to complete opaqueness and 0 represents complete transparency.
None CDPL.Vis.Color.__init__ | ( | Color | color | ) |
Initializes a copy of the Color instance color.
color | The Color instance to copy. |
None CDPL.Vis.Color.__init__ | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) |
Constructs and initializes a Color
object with the RGBA components set to the specified values.
Component values outside the interval [0, 1] are clamped to the nearest interval bound, i.e. 0 if the value is negative and 1 if the value is greater than one.
red | The value of the red color component. |
green | The value of the green color component. |
blue | The value of the blue color component. |
alpha | The value of the alpha component. |
int CDPL.Vis.Color.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python Color instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b
thus cannot tell reliably whether the two Color instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID()
.
Replaces the current state of self with a copy of the state of the Color instance color.
color | The Color instance to copy. |
float CDPL.Vis.Color.getAlpha | ( | ) |
Returns the value of the alpha component.
None CDPL.Vis.Color.setAlpha | ( | float | alpha | ) |
Sets the value of the alpha component to alpha.
If alpha is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if alpha is negative and 1 if alpha is greater than one.
alpha | The value of the alpha component. |
float CDPL.Vis.Color.getBlue | ( | ) |
Returns the value of the blue color component.
None CDPL.Vis.Color.setBlue | ( | float | blue | ) |
Sets the value of the blue color component to blue.
If blue is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if blue is negative and 1 if blue is greater than one.
blue | The value of the blue color component. |
float CDPL.Vis.Color.getGreen | ( | ) |
Returns the value of the green color component.
None CDPL.Vis.Color.setGreen | ( | float | green | ) |
Sets the the value of green color component to green.
If green is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if green is negative and 1 if green is greater than one.
green | The value of the green color component. |
float CDPL.Vis.Color.getRed | ( | ) |
Returns the value of the red color component.
None CDPL.Vis.Color.setRed | ( | float | red | ) |
Sets the value of the red color component to red.
If red is outside the interval [0, 1] the value is clamped to the nearest interval bound, i.e. 0 if red is negative and 1 if red is greater than one.
red | The value of the red color component. |
None CDPL.Vis.Color.setRGBA | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) |
Sets the values of the RGBA components to specified values.
Component values outside the interval [0, 1] are clamped to the nearest interval bound, i.e. 0 if the value is negative and 1 if the value is greater than one.
red | The value of the red color component. |
green | The value of the green color component. |
blue | The value of the blue color component. |
alpha | The value of the alpha component. |
bool CDPL.Vis.Color.__eq__ | ( | Color | color | ) |
Equality comparison operator.
color | The other Color object to be compared with. |
True
if all pairs of the RGBA components compare equal, False
otherwise. bool CDPL.Vis.Color.__ne__ | ( | Color | color | ) |
Inequality comparison operator.
The result is equivalent to !(self == color)
.
color | The other Color object to be compared with. |
True
if at least one pair of the RGBA components compares non-equal, False
otherwise. str CDPL.Vis.Color.__str__ | ( | ) |
Returns a string representation of the Color instance.