libcvd
Public Member Functions | Public Attributes | Related Functions | List of all members
CVD::Rgba< T > Class Template Reference

A colour consisting of red, green, blue and alpha components. More...

#include <rgba.h>

Public Member Functions

 Rgba (const Rgba &)=default
 
Rgba & operator= (const Rgba &)=default
 
 Rgba (T r, T g, T b, T a)
 Constructs a colour as specified. More...
 
template<class S >
 Rgba (const Rgba< S > &rgba)
 
template<typename T2 >
Rgba< T > & operator= (const Rgba< T2 > &c)
 Assignment operator between two different storage types, using the standard casts as necessary. More...
 
bool operator== (const Rgba< T > &c) const
 Logical equals operator. More...
 
bool operator!= (const Rgba< T > &c) const
 Logical not-equals operator. More...
 

Public Attributes

T red
 The red component.
 
T green
 The green component.
 
T blue
 The blue component.
 
T alpha
 The alpha component.
 

Related Functions

(Note that these are not member functions.)

template<typename T >
std::ostream & operator<< (std::ostream &os, const Rgba< T > &x)
 Write the colour to a stream in the format "(red,green,blue,alpha)". More...
 
std::ostream & operator<< (std::ostream &os, const Rgba< unsigned char > &x)
 Write the colour to a stream in the format "(red,green,blue,alpha)". More...
 

Detailed Description

template<typename T>
class CVD::Rgba< T >

A colour consisting of red, green, blue and alpha components.

Parameters
TThe datatype of each component

Constructor & Destructor Documentation

◆ Rgba()

template<typename T>
CVD::Rgba< T >::Rgba ( T  r,
T  g,
T  b,
T  a 
)
inlineexplicit

Constructs a colour as specified.

Parameters
rThe red component
gThe green component
bThe blue component
aThe alpha component

Member Function Documentation

◆ operator!=()

template<typename T>
bool CVD::Rgba< T >::operator!= ( const Rgba< T > &  c) const
inline

Logical not-equals operator.

Returns true unless each component is the same.

Parameters
cRgba to compare with

◆ operator=()

template<typename T>
template<typename T2 >
Rgba<T>& CVD::Rgba< T >::operator= ( const Rgba< T2 > &  c)
inline

Assignment operator between two different storage types, using the standard casts as necessary.

Parameters
cThe colour to copy from

◆ operator==()

template<typename T>
bool CVD::Rgba< T >::operator== ( const Rgba< T > &  c) const
inline

Logical equals operator.

Returns true if each component is the same.

Parameters
cRgba to compare with

Friends And Related Function Documentation

◆ operator<<() [1/2]

template<typename T >
std::ostream & operator<< ( std::ostream &  os,
const Rgba< T > &  x 
)
related

Write the colour to a stream in the format "(red,green,blue,alpha)".

Parameters
osThe stream
xThe colour object

◆ operator<<() [2/2]

template<typename T>
std::ostream & operator<< ( std::ostream &  os,
const Rgba< unsigned char > &  x 
)
related

Write the colour to a stream in the format "(red,green,blue,alpha)".

Parameters
osThe stream
xThe colour object

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