Avogadro  1.1.0
Public Member Functions | Protected Attributes
Avogadro::Color3f Class Reference

Representation of an RGB color using three floats. More...

#include <avogadro/color3f.h>

List of all members.

Public Member Functions

 Color3f (float red=0.0, float green=0.0, float blue=0.0)
 Color3f (int red, int green, int blue)
void set (float red, float green, float blue)
float red () const
float green () const
float blue () const
float * data ()
const float * data () const

Protected Attributes

float m_data [3]

Detailed Description

Representation of an RGB color using three floats.

Author:
Marcus D. Hanwell

This class represents a color as three floats ranging from 0.0 to 1.0 specifying the intensity of the red, green and blue components of the color. It is stored in memory as float[3], and so vectors containing this type may be passed directly to OpenGL and other functions as C arrays.

Several convenience functions are provided, the class is written with an emphasis on efficiency and memory layout.


Constructor & Destructor Documentation

Avogadro::Color3f::Color3f ( float  red = 0.0,
float  green = 0.0,
float  blue = 0.0 
) [inline]

Constructor, results in a black Color3f object unless the RGB values are set.

Parameters:
redIntensity (from 0.0 to 1.0) of the red component of the color.
greenIntensity (from 0.0 to 1.0) of the green component of the color.
blueIntensity (from 0.0 to 1.0) of the blue component of the color.

References blue(), green(), and red().

Avogadro::Color3f::Color3f ( int  red,
int  green,
int  blue 
) [inline]

Constructor where the color is constructed from integer values.

Parameters:
redIntensity (from 0 to 255) of the red component of the color.
greenIntensity (from 0 to 255) of the green component of the color.
blueIntensity (from 0 to 255) of the blue component of the color.

Member Function Documentation

float Avogadro::Color3f::blue ( ) const [inline]
Returns:
The intensity of the blue component of the color (0.0 to 1.0).

Referenced by Avogadro::GLPainter::applyAsMaterials(), Color3f(), and set().

float * Avogadro::Color3f::data ( ) [inline]
Returns:
Direct access to the underlying float array of size 3.

Referenced by Avogadro::GLPainter::apply().

const float * Avogadro::Color3f::data ( ) const [inline]

This function is useful when calling OpenGL functions which expect a float * array of size 3.

Returns:
Direct access to the underlying float array of size 3.
float Avogadro::Color3f::green ( ) const [inline]
Returns:
The intensity of the green component of the color (0.0 to 1.0).

Referenced by Avogadro::GLPainter::applyAsMaterials(), Color3f(), and set().

float Avogadro::Color3f::red ( ) const [inline]
Returns:
The intensity of the red component of the color (0.0 to 1.0).

Referenced by Avogadro::GLPainter::applyAsMaterials(), Color3f(), and set().

void Avogadro::Color3f::set ( float  red,
float  green,
float  blue 
) [inline]

Sets the color objects components.

Parameters:
redIntensity (from 0.0 to 1.0) of the red component of the color.
greenIntensity (from 0.0 to 1.0) of the green component of the color.
blueIntensity (from 0.0 to 1.0) of the blue component of the color.

References blue(), green(), and red().


The documentation for this class was generated from the following file: