NAP
Public Member Functions | List of all members
RGBAColor< T > Class Template Reference

#include <color.h>

Public Member Functions

 RGBAColor (T red, T green, T blue, T alpha)
 
 RGBAColor (const RGBColor< T > &rgb, T alpha)
 
 RGBAColor ()
 
 RGBAColor (const nap::BaseColor &source)
 
void setRed (T value)
 
getRed () const
 
void setGreen (T value)
 
getGreen () const
 
void setBlue (T value)
 
getBlue () const
 
void setAlpha (T value)
 
getAlpha () const
 
glm::vec4 toVec4 () const
 
 operator glm::vec4 ()
 
- Public Member Functions inherited from Color< T, 4 >
 Color ()
 
 Color (const std::array< T, CHANNELS > &colors)
 
 Color (const nap::BaseColor &source)
 
rtti::TypeInfo getValueType () const override
 
bool isPointer () const override
 
getValue (EColorChannel channel) const
 
T & getValue (EColorChannel channel)
 
void setValue (EColorChannel channel, T value)
 
const std::array< T, CHANNELS > & getValues () const
 
T * getData ()
 
const T * getData () const
 
void setData (const T *data)
 
float getDistance (const Color< T, CHANNELS > &other) const
 
bool operator== (const Color< T, CHANNELS > &rhs) const
 
bool operator!= (const Color< T, CHANNELS > &rhs) const
 
bool operator< (const Color< T, CHANNELS > &rhs) const
 
bool operator> (const Color< T, CHANNELS > &rhs) const
 
bool operator<= (const Color< T, CHANNELS > &rhs) const
 
bool operator>= (const Color< T, CHANNELS > &rhs) const
 
T & operator[] (std::size_t index)
 
const T & operator[] (std::size_t index) const
 
- Public Member Functions inherited from BaseColor
 BaseColor (int channels, int size)
 
virtual ~BaseColor ()=default
 
bool operator== (const BaseColor &rhs)=delete
 
bool operator!= (const BaseColor &rhs)=delete
 
int getNumberOfChannels () const
 
int valueSize () const
 
virtual rtti::TypeInfo getValueType () const =0
 
virtual bool isPointer () const =0
 
void convert (BaseColor &target) const
 
Converter getConverter (const BaseColor &target) const
 
template<typename T >
convert () const
 
int size () const
 

Additional Inherited Members

- Public Types inherited from Color< T, 4 >
using value_type = T
 
- Public Types inherited from BaseColor
using Converter = std::function< void(const BaseColor &, BaseColor &, int)>
 
- Static Public Member Functions inherited from BaseColor
static void convertColor (const BaseColor &source, BaseColor &target)
 
static void convertColor (const BaseColor &source, BaseColor &target, const Converter &converter)
 
static Converter getConverter (const BaseColor &source, const BaseColor &target)
 
- Public Attributes inherited from Color< T, 4 >
std::array< T, CHANNELS > mValues
 

Description

template<typename T>
class nap::RGBAColor< T >

Color that has a red, green, blue and alpha channel of type T

Inheritance diagram for RGBAColor< T >:
[legend]
Collaboration diagram for RGBAColor< T >:
[legend]

Constructor & Destructor Documentation

◆ RGBAColor() [1/4]

RGBAColor ( red,
green,
blue,
alpha 
)

Constructor that creates an RGB color based on the given values

◆ RGBAColor() [2/4]

RGBAColor ( const RGBColor< T > &  rgb,
alpha 
)

Constructor that creates an RGBA color based on the given RGB color and alpha value.

Parameters
rgbthe RGB color
alphathe alpha value

◆ RGBAColor() [3/4]

RGBAColor ( )

Default constructor

◆ RGBAColor() [4/4]

RGBAColor ( const nap::BaseColor source)

Initialize using a different type of color. Colors are converted. The source color must have an equal or higher amount of channels.

Parameters
sourcethe source color to convert.

Member Function Documentation

◆ getAlpha()

T getAlpha ( ) const

◆ getBlue()

T getBlue ( ) const

◆ getGreen()

T getGreen ( ) const

◆ getRed()

T getRed ( ) const

◆ operator glm::vec4()

operator glm::vec4 ( )

vec4 conversion function

Returns
the color as a vec4 (float)

◆ setAlpha()

void setAlpha ( value)

Sets the alpha channel to the incoming value

Parameters
valuealpha color value

◆ setBlue()

void setBlue ( value)

Sets the blue channel to the given value.

Parameters
valuenew color value

◆ setGreen()

void setGreen ( value)

Sets the green channel to the given value

Parameters
valuegreen color value

◆ setRed()

void setRed ( value)

Sets the red channel to the incoming value

Parameters
valuered color value

◆ toVec4()

glm::vec4 toVec4
Returns
the color as a vec4 (float)