Avogadro
1.1.0
|
Map a primitive (atom, bond, etc.) to a OpenGL red, green, blue, alpha color. More...
#include <avogadro/color.h>
Signals | |
void | changed () |
Public Member Functions | |
Color (float red, float green, float blue, float alpha=1.0) | |
Color (const Primitive *p) | |
virtual void | apply () |
virtual void | applyAsMaterials () |
virtual void | applyAsFlatMaterials () |
QColor | color () const |
float | red () const |
float | green () const |
float | blue () const |
float | alpha () const |
virtual void | setName (const QString &name) |
virtual QString | name () const |
virtual QString | identifier () const |
virtual Plugin::Type | type () const |
Set Color Methods | |
These methods assign a color based on a primitive, index value (int), or gradient (float/double). They are the main use of color plugins. | |
virtual void | setFromPrimitive (const Primitive *p) |
virtual void | setFromIndex (const unsigned int index) |
virtual void | setFromGradient (const double value, const double lo, const double mid, const double hi) |
Explicit Color Methods | |
These methods assign a color based on explicit assignment. | |
virtual void | setFromRgba (float red, float green, float blue, float alpha=1.0) |
virtual void | setFromQColor (const QColor &color) |
virtual void | setToSelectionColor () |
virtual void | setAlpha (double alpha) |
Protected Attributes | |
float | m_channels [4] |
QString | m_name |
ColorPrivate * | d |
Map a primitive (atom, bond, etc.) to a OpenGL red, green, blue, alpha color.
Color plugins are used to provide custom coloring for engines -- mapping atoms and residues. Provide new plugins based on atomic or residue properties
Avogadro::Color::Color | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) |
This constructor sets the four components of the color individually. Each one ranges from 0.0 (lowest intensity) to 1.0 (highest intensity). For the alpha component, 0.0 means totally transparent and 1.0 (the default) means totally opaque.
red | The red component of the color |
green | The green component |
blue | The blue component |
alpha | The opacity of the color |
References alpha(), blue(), green(), m_channels, and red().
Avogadro::Color::Color | ( | const Primitive * | p | ) |
Set the color based on the supplied Primitive. If NULL is passed do nothing.
p | the color is derived from this primitive. |
References setFromPrimitive().
float Avogadro::Color::alpha | ( | ) | const [inline] |
Referenced by Color(), setAlpha(), Avogadro::GLPainter::setColor(), and setFromRgba().
void Avogadro::Color::apply | ( | ) | [virtual] |
Sets this color to be the one used by OpenGL for rendering when lighting is disabled.
References m_channels.
void Avogadro::Color::applyAsFlatMaterials | ( | ) | [virtual] |
Applies an OpenGL material more appropriate for flat surfaces.
References m_channels.
void Avogadro::Color::applyAsMaterials | ( | ) | [virtual] |
Applies nice OpenGL materials using this color as the diffuse color while using different shades for the ambient and specular colors. This is only useful if lighting is enabled.
References m_channels.
float Avogadro::Color::blue | ( | ) | const [inline] |
Referenced by Color(), Avogadro::GLPainter::setColor(), and setFromRgba().
void Avogadro::Color::changed | ( | ) | [signal] |
Signals that something has been changed and the engine needs to render after these changes were made.
QColor Avogadro::Color::color | ( | ) | const [inline] |
References QColor::setRgbF().
float Avogadro::Color::green | ( | ) | const [inline] |
Referenced by Color(), Avogadro::GLPainter::setColor(), and setFromRgba().
QString Avogadro::Color::identifier | ( | ) | const [virtual] |
Implements Avogadro::Plugin.
QString Avogadro::Color::name | ( | ) | const [virtual] |
Implements Avogadro::Plugin.
References QString::isEmpty(), and m_name.
Referenced by setName().
float Avogadro::Color::red | ( | ) | const [inline] |
Referenced by Color(), Avogadro::GLPainter::setColor(), and setFromRgba().
void Avogadro::Color::setAlpha | ( | double | alpha | ) | [virtual] |
Set the alpha component of the color, 0.0 means totally transparent and 1.0 means totally opaque.
alpha | The opacity of the color |
References alpha(), and m_channels.
void Avogadro::Color::setFromGradient | ( | const double | value, |
const double | lo, | ||
const double | mid, | ||
const double | hi | ||
) | [virtual] |
Set the color based on the supplied floating point value (e.g., a gradient).
value | the floating point number to consider |
lo | the low point of the range |
mid | the middle point of the range (e.g., 0.0) |
hi | the high point of the range |
void Avogadro::Color::setFromIndex | ( | const unsigned int | index | ) | [virtual] |
Set the color based on the supplied index (e.g., in an indexed color table).
index | the color is derived from this value |
void Avogadro::Color::setFromPrimitive | ( | const Primitive * | p | ) | [virtual] |
void Avogadro::Color::setFromQColor | ( | const QColor & | color | ) | [virtual] |
Set the color explicitly based on a QColor, copying RGB and Alpha levels.
color | The explicit color to use. |
References QColor::alphaF(), QColor::blueF(), QColor::greenF(), m_channels, and QColor::redF().
void Avogadro::Color::setFromRgba | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha = 1.0 |
||
) | [virtual] |
Set the four components of the color individually. Each one ranges from 0.0 (lowest intensity) to 1.0 (highest intensity). For the alpha component, 0.0 means totally transparent and 1.0 (the default) means totally opaque.
red | The red component of the color |
green | The green component |
blue | The blue component |
alpha | The opacity of the color |
References alpha(), blue(), green(), m_channels, and red().
void Avogadro::Color::setName | ( | const QString & | name | ) | [virtual] |
void Avogadro::Color::setToSelectionColor | ( | ) | [virtual] |
Set the color to the selection color. By default, the selection color is (0.3, 0.6, 1.0, 0.7). which is a light transparent blue
References m_channels.
virtual Plugin::Type Avogadro::Color::type | ( | ) | const [inline, virtual] |
Implements Avogadro::Plugin.
ColorPrivate* Avogadro::Color::d [protected] |
The d-pointer used to preserve binary compatibility.
Avogadro::Color::m_channels [protected] |
The components of the color ranging from 0 to 1.
Referenced by apply(), applyAsFlatMaterials(), applyAsMaterials(), Color(), setAlpha(), setFromQColor(), setFromRgba(), and setToSelectionColor().
QString Avogadro::Color::m_name [protected] |