Imagine++
Public Member Functions | List of all members
Imagine::RGB< T > Class Template Reference

RED GREEN BLUE color. More...

#include "Imagine/Common.h"

Inheritance diagram for Imagine::RGB< T >:
Imagine::FVector< T, 3 > Imagine::FArray< T, dim >

Public Member Functions

 RGB ()
 Empty constructor. More...
 
 RGB (T v)
 Constructor with constant value. More...
 
 RGB (T r, T g, T b)
 Constructor with r,g,b values Constructs a RGB of type T. More...
 
 RGB (const T t[3])
 Constructor from C array. More...
 
 RGB (const Base &x)
 Copy constructor. More...
 
template<typename T2 >
 RGB (const FVector< T2, 3 > &x)
 Constructor from other value type Constructs from RGB with different type. More...
 
template<typename T2 >
 RGB (const FArray< T2, 4 > &x)
 Constructor from RGBA. More...
 
const T & b () const
 Read BLUE alias. More...
 
T & b ()
 Write BLUE alias. More...
 
const T & g () const
 Read GREEN alias. More...
 
T & g ()
 Write GREEN alias. More...
 
 operator T () const
 To greyscale. More...
 
const T & r () const
 Read RED alias. More...
 
T & r ()
 Write RED alias. More...
 
- Public Member Functions inherited from Imagine::FVector< T, 3 >
 FVector ()
 Empty constructor. More...
 
 FVector (const T &v)
 Constructor with constant value. More...
 
 FVector (const T2 t[dim])
 Constructor from C array. More...
 
 FVector (const FArray< T2, dim > &a)
 Copy constructor. More...
 
 FVector (T x, T y)
 2D alias. More...
 
 FVector (T x, T y, T z)
 3D alias. More...
 
FVectorfill (const T &v)
 Filling. More...
 
FVectornormalize ()
 Euclidean in-place normalization. More...
 
operator* (const FVector &v) const
 Scalar product. More...
 
FVector operator* (T s) const
 Scalar multiplication. More...
 
FVectoroperator*= (T s)
 Scalar in place multiplication. More...
 
FVector operator+ (const FVector &v) const
 Addition. More...
 
FVector operator+ (T s) const
 Scalar Addition. More...
 
FVectoroperator+= (const FVector &v)
 In place Addition. More...
 
FVectoroperator+= (T s)
 Scalar in place Addition. More...
 
FVector operator- (const FVector &v) const
 Substraction. More...
 
FVector operator- (T s) const
 Scalar Substraction. More...
 
FVector operator- () const
 Opposite. More...
 
FVectoroperator-= (const FVector &v)
 In place Substraction. More...
 
FVectoroperator-= (T s)
 Scalar in place substractrion. More...
 
FVector operator/ (T s) const
 Scalar division. More...
 
FVectoroperator/= (T s)
 Scalar in place division. More...
 
FVectoroperator= (const FArray< T2, dim > &b)
 Assignment. More...
 
operator^ (const FVector< T, 2 > &v) const
 2D cross product. More...
 
FVector< T, 3 > operator^ (const FVector< T, 3 > &v) const
 3D cross product. More...
 
const T & x () const
 Read alias. More...
 
T & x ()
 Write alias. More...
 
const T & y () const
 Read alias. More...
 
T & y ()
 Write alias. More...
 
const T & z () const
 Read alias. More...
 
T & z ()
 Write alias. More...
 
- Public Member Functions inherited from Imagine::FArray< T, dim >
 FArray ()
 Empty constructor. More...
 
 FArray (const T &v)
 Constructor with constant value. More...
 
 FArray (const T2 t[S])
 Constructor from C array. More...
 
 FArray (const FArray< T2, S > &a)
 Copy constructor. More...
 
 FArray (T v0, T v1)
 2D alias. More...
 
 FArray (T v0, T v1, T v2)
 3D alias. More...
 
 FArray (T v0, T v1, T v2, T v3)
 4D alias. More...
 
iterator begin ()
 Begin iterator. More...
 
const_iterator begin () const
 Begin const iterator. More...
 
FArraycopy (const T2 t[S])
 C array of different type copy. More...
 
FArraycopy (const FArray< T2, S > &b)
 Copy. More...
 
const T * data () const
 Data pointer (read). More...
 
T * data ()
 Data pointer (write). More...
 
bool empty () const
 Is empty. More...
 
iterator end ()
 End iterator. More...
 
const_iterator end () const
 End const iterator. More...
 
FArrayfill (const T &v)
 Filling. More...
 
bool operator!= (const FArray &b) const
 Inequality test. More...
 
FArrayoperator= (const FArray< T2, S > &b)
 Assignment. More...
 
bool operator== (const FArray &b) const
 Equality test. More...
 
const T & operator[] (int i) const
 Read access. More...
 
T & operator[] (int i)
 Write access. More...
 
int size () const
 Size. More...
 

Additional Inherited Members

- Public Types inherited from Imagine::FArray< T, dim >
typedef const T * const_iterator
 Const iterator type.
 
typedef T * iterator
 Iterator type.
 
- Static Public Member Functions inherited from Imagine::FVector< T, 3 >
static FVector Zero ()
 Zero vector Vector with constant 0 value. More...
 
- Protected Attributes inherited from Imagine::FArray< T, dim >
_data [S]
 internal storage.
 

Detailed Description

template<typename T>
class Imagine::RGB< T >

RED GREEN BLUE color

Parameters
Tvalue type
Examples:
Common/test/test.cpp, Graphics/test/example.cpp, Graphics/test/particles.cpp, Graphics/test/test.cpp, and Images/test/test.cpp.

Constructor & Destructor Documentation

◆ RGB() [1/7]

template<typename T>
Imagine::RGB< T >::RGB ( )
inline

Constructs an uninitialized RGB of type T

RGB<double> a; // uninitialized

◆ RGB() [2/7]

template<typename T>
Imagine::RGB< T >::RGB ( v)
inlineexplicit

Constructs a RGB of type T, each initialized to v

Parameters
vvalue used for initialization
RGB<double> b(.6); // filled with constant value

◆ RGB() [3/7]

template<typename T>
Imagine::RGB< T >::RGB ( r,
g,
b 
)
inline
Parameters
r,g,bRED, GREEN, BLUE values
RGB<double> c(.12,.3,.43); // rgb values

◆ RGB() [4/7]

template<typename T>
Imagine::RGB< T >::RGB ( const T  t[3])
inlineexplicit

Constructs a RGB of type T, and copies values to it

Parameters
tC array used for initialization
double t1[]={.2,1.,.23}; // filled from C array
RGB<double> d(t1); // ...

◆ RGB() [5/7]

template<typename T>
Imagine::RGB< T >::RGB ( const Base x)
inline

Constructs from another RGB

Parameters
xRGB to copy
RGB<double> e(d); // copy constructor

◆ RGB() [6/7]

template<typename T>
template<typename T2 >
Imagine::RGB< T >::RGB ( const FVector< T2, 3 > &  x)
inline
Parameters
xRGB to copy
Template Parameters
T2value type of x
RGB<float> f(e); // from another type

◆ RGB() [7/7]

template<typename T>
template<typename T2 >
Imagine::RGB< T >::RGB ( const FArray< T2, 4 > &  x)
inline

Constructs from RGBA (ignores a)

Parameters
xRGBA to copy
Template Parameters
T2value type of x
RGBA<double>g(.1,.2,.6,.3); // RGBA -> RGB
RGB<float> h(g); // ...

Member Function Documentation

◆ b() [1/2]

template<typename T>
const T& Imagine::RGB< T >::b ( ) const
inline

Read BLUE alias

Returns
const ref. to BLUE
x=e.b(); // Read BLUE alias

◆ b() [2/2]

template<typename T>
T& Imagine::RGB< T >::b ( )
inline

Write BLUE alias

Returns
ref. to BLUE
e.b()=x; // Write BLUE alias

◆ g() [1/2]

template<typename T>
const T& Imagine::RGB< T >::g ( ) const
inline

Read GREEN alias

Returns
const ref. to GREEN
x=e.g(); // Read GREEN alias

◆ g() [2/2]

template<typename T>
T& Imagine::RGB< T >::g ( )
inline

Write GREEN alias

Returns
ref. to GREEN
e.g()=x; // Write GREEN alias

◆ operator T()

template<typename T>
Imagine::RGB< T >::operator T ( ) const
inline

Convert to greyscale (grey=0.3*r+0.59*g+0.11*b)

Returns
greyscale value
float grey=float(c); // to greyscale

◆ r() [1/2]

template<typename T>
const T& Imagine::RGB< T >::r ( ) const
inline

Read RED alias

Returns
const ref. to RED
x=e.r(); // Read RED alias

◆ r() [2/2]

template<typename T>
T& Imagine::RGB< T >::r ( )
inline

Write RED alias

Returns
ref. to RED
e.r()=x; // Write RED alias


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