Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::GenColor< T > Class Template Reference

A generic color type. More...

#include <geogram/image/color.h>

Inheritance diagram for GEO::GenColor< T >:
GEO::vecng< 4, T >

Public Types

typedef vecng< 4, T > superclass
 The superclass type.
 
- Public Types inherited from GEO::vecng< 4, T >
typedef vecng< dim, T > vector_type
 This vector type. More...
 
typedef T value_type
 The type of the vector coordinates. More...
 

Public Member Functions

 GenColor (const superclass &rhs)
 GenColor copy constructor. More...
 
 GenColor (const T *rhs)
 GenColor constructor from T array. More...
 
 GenColor (T r=0, T g=0, T b=0, T a=1)
 GenColor constructor from 4 parameters. More...
 
GenColoroperator= (const superclass &rhs)
 assignment operator. More...
 
r () const
 Gets the red component. More...
 
g () const
 Gets the green component. More...
 
b () const
 Gets the blue component. More...
 
a () const
 Gets the alpha component (transparency). More...
 
void set_r (T r)
 Sets the red component. More...
 
void set_g (T g)
 Sets the green component. More...
 
void set_b (T b)
 Sets the blue component. More...
 
void set_a (T a)
 Sets the alpha component (transparency). More...
 
- Public Member Functions inherited from GEO::vecng< 4, T >
 vecng ()
 Default vector constructor. More...
 
 vecng (T x_in, T y_in, T z_in, T w_in)
 Constructs a vector from coordinates. More...
 
template<class T2 >
 vecng (const vecng< dim, T2 > &v)
 Constructs a vector by copy. More...
 
template<class T2 >
 vecng (const T2 *v)
 Constructs a vector from an array. More...
 
 vecng (const std::initializer_list< T > &Vi)
 
length2 () const
 Gets the squared length of the vector. More...
 
length () const
 Gets the length of the vector. More...
 
distance2 (const vector_type &v) const
 Gets the squared distance to a vector. More...
 
distance (const vector_type &v) const
 Gets the distance to a vector. More...
 
index_t dimension () const
 Gets the vector dimension. More...
 
vector_typeoperator+= (const vector_type &v)
 Adds a vector in place. More...
 
vector_typeoperator-= (const vector_type &v)
 Subtracts a vector in place. More...
 
template<class T2 >
vector_typeoperator*= (T2 s)
 Multiplies by a scalar in place. More...
 
template<class T2 >
vector_typeoperator/= (T2 s)
 Divides by a scalar in place. More...
 
vector_type operator+ (const vector_type &v) const
 Adds 2 vectors. More...
 
vector_type operator- (const vector_type &v) const
 Subtracts 2 vectors. More...
 
template<class T2 >
vector_type operator* (T2 s) const
 Multiplies a vector by a scalar. More...
 
template<class T2 >
vector_type operator/ (T2 s) const
 Divides a vector by a scalar. More...
 
vector_type operator- () const
 Negates a vector. More...
 
T * data ()
 Gets modifiable vector data. More...
 
const T * data () const
 Gets non-modifiable vector data. More...
 
T & operator[] (index_t i)
 Gets a modifiable vector coordinate. More...
 
const T & operator[] (index_t i) const
 Gets a non-modifiable vector coordinate. More...
 

Additional Inherited Members

- Public Attributes inherited from GEO::vecng< 4, T >
x
 Vector x coordinate.
 
y
 Vector y coordinate.
 
z
 Vector z coordinate.
 
w
 Vector w coordinate.
 
- Static Public Attributes inherited from GEO::vecng< 4, T >
static const index_t dim = 4
 The dimension of the vector. More...
 

Detailed Description

template<class T>
class GEO::GenColor< T >

A generic color type.

Template Parameters
Ttype of the components

Definition at line 57 of file color.h.

Constructor & Destructor Documentation

◆ GenColor() [1/3]

template<class T >
GEO::GenColor< T >::GenColor ( const superclass rhs)
inline

GenColor copy constructor.

Parameters
[in]rhsthe GenColor to be copied.

Definition at line 68 of file color.h.

◆ GenColor() [2/3]

template<class T >
GEO::GenColor< T >::GenColor ( const T *  rhs)
inline

GenColor constructor from T array.

Parameters
[in]rhsa pointer to an array of 4 Ts

Definition at line 75 of file color.h.

◆ GenColor() [3/3]

template<class T >
GEO::GenColor< T >::GenColor ( r = 0,
g = 0,
b = 0,
a = 1 
)
inline

GenColor constructor from 4 parameters.

Parameters
[in]r,g,b,athe components of the color

Definition at line 82 of file color.h.

Member Function Documentation

◆ a()

template<class T >
T GEO::GenColor< T >::a ( ) const
inline

Gets the alpha component (transparency).

Returns
the value of the alpha component

Definition at line 125 of file color.h.

◆ b()

template<class T >
T GEO::GenColor< T >::b ( ) const
inline

Gets the blue component.

Returns
the value of the blue component

Definition at line 117 of file color.h.

◆ g()

template<class T >
T GEO::GenColor< T >::g ( ) const
inline

Gets the green component.

Returns
the value of the green component

Definition at line 109 of file color.h.

◆ operator=()

template<class T >
GenColor& GEO::GenColor< T >::operator= ( const superclass rhs)
inline

assignment operator.

Parameters
[in]rhsthe GenColor to be copied
Returns
the new value of this GenColor after assignment

Definition at line 92 of file color.h.

◆ r()

template<class T >
T GEO::GenColor< T >::r ( ) const
inline

Gets the red component.

Returns
the value of the red component

Definition at line 101 of file color.h.

◆ set_a()

template<class T >
void GEO::GenColor< T >::set_a ( a)
inline

Sets the alpha component (transparency).

Parameters
[in]athe value of the alpha component

Definition at line 157 of file color.h.

◆ set_b()

template<class T >
void GEO::GenColor< T >::set_b ( b)
inline

Sets the blue component.

Parameters
[in]bthe value of the blue component

Definition at line 149 of file color.h.

◆ set_g()

template<class T >
void GEO::GenColor< T >::set_g ( g)
inline

Sets the green component.

Parameters
[in]gthe value of the green component

Definition at line 141 of file color.h.

◆ set_r()

template<class T >
void GEO::GenColor< T >::set_r ( r)
inline

Sets the red component.

Parameters
[in]rthe value of the red component

Definition at line 133 of file color.h.


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