[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

| RGBValue Class Template Reference |
--- | --- | ---

Class for a single RGB value. More...

`#include "vigra/rgbvalue.hxx"`

Inheritance diagram for RGBValue:

## Public Types
typedef VALUETYPE | value_type
typedef TinyVector< VALUETYPE, 3 >::iterator | iterator
typedef TinyVector< VALUETYPE, 3 >::const_iterator | const_iterator
## Public Methods
| RGBValue (value_type red, value_type green, value_type blue)
| RGBValue (value_type gray)
template<class Iterator> | RGBValue (Iterator i, Iterator end)
| RGBValue ()
template<class U> | RGBValue (RGBValue< U > const &r)
template<class U> RGBValue & | operator= (RGBValue< U > const &r)
| RGBValue (TinyVector< value_type, 3 > const &r)
RGBValue & | operator= (TinyVector< value_type, 3 > const &r)
RGBValue | operator- () const
value_type & | red ()
value_type & | green ()
value_type & | blue ()
value_type const & | red () const
value_type const & | green () const
value_type const & | blue () const
value_type | luminance () const
NumericTraits< VALUETYPE >::RealPromote | magnitude () const
NumericTraits< VALUETYPE >::Promote | squaredMagnitude () const
template<class V> void | setRed (V value)
template<class V> void | setGreen (V value)
template<class V> void | setBlue (V value)

## Detailed Description

### template<class VALUETYPE>
class vigra::RGBValue< VALUETYPE >

Class for a single RGB value.

This class contains three values (of the specified type) that represent red, green, and blue color channels. There are three possibilities to access these values: accessor functions (red(), green(), blue()), index operator (operator[](dx), where 0 is red, 1 is green and 2 is blue) and iterator (STL-compatible random access iterator that references the three colors in turn). The latter two methods, together with the necessary embedded typedefs, ensure compatibility of a RGBValue with a STL vector.

Arithmetic operations are defined as component-wise applications of these operations. Addition, subtraction, and multiplication of two RGBValues (+=, -=, *=, +, -, *, unary -), multiplication and division of an RGBValue with a double, and NumericTraits/PromoteTraits are defined, so that RGBValue fulfills the requirements of a LinearAlgebra.

A number of accessors are provided that support access to RGBValues as a whole, to a selected color component, or to the luminance value.

#include "vigra/rgbvalue.hxx"
Namespace: vigra

Examples:

  invert.cxx, invert_explicitly.cxx, and watershed.cxx.

## Member Typedef Documentation

typedef TinyVector<VALUETYPE, 3>::const_iterator const_iterator

| STL-compatible definition of const iterator Reimplemented from TinyVector< VALUETYPE, 3 >.

typedef TinyVector<VALUETYPE, 3>::iterator iterator

| STL-compatible definition of iterator Reimplemented from TinyVector< VALUETYPE, 3 >.

typedef VALUETYPE value_type

| STL-compatible definition of valuetype Reimplemented from TinyVector< VALUETYPE, 3 >.

## Constructor & Destructor Documentation

RGBValue | ( | value_type | red,
|  | value_type | green,
|  | value_type | blue
| ) | `[inline]`

| Construct from explicit color values

RGBValue | ( | value_type | gray | ) | `[inline]`

| Construct gray value

RGBValue | ( | Iterator | i,
|  | Iterator | end
| ) | `[inline]`

| Construct from another sequence (must have length 3!)

RGBValue | ( |  | ) | `[inline]`

| Default constructor (sets all components to 0)

RGBValue | ( | RGBValue< U > const & | r | ) | `[inline]`

| Copy constructor.

RGBValue | ( | TinyVector< value_type, 3 > const & | r | ) | `[inline]`

| construct from TinyVector

## Member Function Documentation

value_type const& blue | ( |  | ) | const`[inline]`

| Get blue component.

value_type& blue | ( |  | ) | `[inline]`

| Access blue component.

value_type const& green | ( |  | ) | const`[inline]`

| Get green component.

value_type& green | ( |  | ) | `[inline]`

| Access green component.

value_type luminance | ( |  | ) | const`[inline]`

| Calculate luminance.

NumericTraits<VALUETYPE>::RealPromote magnitude | ( |  | ) | const`[inline]`

| Calculate magnitude. Reimplemented from TinyVectorBase< VALUETYPE, SIZE, VALUETYPE[SIZE], TinyVector< VALUETYPE, SIZE > >.

RGBValue operator- | ( |  | ) | const`[inline]`

| Unary negation (construct RGBValue with negative values)

RGBValue& operator= | ( | TinyVector< value_type, 3 > const & | r | ) | `[inline]`

| assign TinyVector.

RGBValue& operator= | ( | RGBValue< U > const & | r | ) | `[inline]`

| Copy assignment.

value_type const& red | ( |  | ) | const`[inline]`

| Get red component.

value_type& red | ( |  | ) | `[inline]`

| Access red component.

void setBlue | ( | V | value | ) | `[inline]`

| Set blue component.The type `V` of the passed in `value` is automatically converted to `VALUETYPE`.

void setGreen | ( | V | value | ) | `[inline]`

| Set green component.The type `V` of the passed in `value` is automatically converted to `VALUETYPE`.

void setRed | ( | V | value | ) | `[inline]`

| Set red component. The type `V` of the passed in `value` is automatically converted to `VALUETYPE`.

NumericTraits<VALUETYPE>::Promote squaredMagnitude | ( |  | ) | const`[inline]`

| Calculate squared magnitude. Reimplemented from TinyVectorBase< VALUETYPE, SIZE, VALUETYPE[SIZE], TinyVector< VALUETYPE, SIZE > >. Examples: watershed.cxx.

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

- vigra/rgbvalue.hxx

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.3.2 (27 Jan 2005)