| Home | Download | Screen shots | Discussion | Documentation |
|---|
A POD-struct comprising a color. More...
#include <openvrml/basetypes.h>
Public Member Functions | |
| const float & | operator[] (std::size_t index) const throw () |
| Index-based component access. More... | |
| float | r () const throw () |
| Get the red component. More... | |
| float | g () const throw () |
| Get the green component. More... | |
| float | b () const throw () |
| Get the blue component. More... | |
| void | r (float value) throw () |
| Set the red component. More... | |
| void | g (float value) throw () |
| Set the green component. More... | |
| void | b (float value) throw () |
| Set the blue component. More... | |
| void | hsv (float(&result)[3]) const throw () |
| Get the color as hue, saturation, and value. More... | |
| void | hsv (float h, float s, float v) throw () |
| Set the color from hue, saturation, and value. More... | |
Public Attributes | |
| float | rgb [3] |
| RGB triplet. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| const openvrml::color | make_color () throw() |
| Create a zero-initialized color. More... | |
| const openvrml::color | make_color (const float(&rgb)[3]) throw() |
| Create a color. More... | |
| const openvrml::color | make_color (const float r, const float g, const float b) throw() |
| Create a color. More... | |
| bool | operator== (const color &lhs, const color &rhs) throw() |
| Compare for equality. More... | |
| bool | operator!= (const color &lhs, const color &rhs) throw() |
| Compare for inequality. More... | |
| std::istream & | operator>> (std::istream &in, color &c) |
| Stream input. More... | |
| std::ostream & | operator<< (std::ostream &out, const color &c) |
| Stream output. More... | |
A POD-struct comprising a color.
VRML colors are represented as three single-precision floating point components—red, green, and blue—ranging from 0.0 to 1.0.
|
inline | ||||||||||||||
Index-based component access.
| [in] | index | 0 is the red component, 1 is the green component, and 2 is the blue component. |
index.
|
inline | |||||||||||||
Get the red component.
|
inline | |||||||||||||
Get the green component.
|
inline | |||||||||||||
Get the blue component.
|
inline | ||||||||||||||
Set the red component.
| [in] | value | the new component value. |
|
inline | ||||||||||||||
Set the green component.
| [in] | value | the new component value. |
|
inline | ||||||||||||||
Set the blue component.
| [in] | value | the new component value. |
| void openvrml::color::hsv | ( | float(&) | result[3] | ) | const |
| throw | ( | ||||
| ) | |||||
Get the color as hue, saturation, and value.
| [out] | result | the hue, saturation, and value. |
| void openvrml::color::hsv | ( | float | h, |
| float | s, | ||
| float | v | ||
| ) | |||
| throw | ( | ||
| ) | |||
Set the color from hue, saturation, and value.
| [in] | h | hue. |
| [in] | s | saturation. |
| [in] | v | value. |
|
related | |||||||||||||
Create a zero-initialized color.
|
related | ||||||||||||||
Create a color.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| [in] | rgb | an array comprising red, green, and blue components. |
|
related | ||||||||||||||||||||||||
Create a color.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| [in] | r | red component. |
| [in] | g | green component. |
| [in] | b | blue component. |
Compare for equality.
| [in] | lhs | left-hand operand. |
| [in] | rhs | right-hand operand. |
true if lhs and rhs have the same value; false otherwise. Compare for inequality.
| [in] | lhs | left-hand operand. |
| [in] | rhs | right-hand operand. |
true if lhs and rhs do not have the same value; false otherwise.
|
related |
Stream input.
Consistent with the VRML97 convention, commas (“,”) in the input are treated as whitespace.
If any of the color components is outside the the range [0.0, 1.0], the failbit will be set on in and c will be left in an arbitrary state.
| [in,out] | in | input stream. |
| [out] | c | a color. |
in.
|
related |
Stream output.
| [in,out] | out | output stream. |
| [in] | c | a color. |
out. | float openvrml::color::rgb[3] |
RGB triplet.