Annwvyn::AnnColor Class Reference

Class that represent a 4 channel color value. More...

#include <AnnColor.hpp>

Public Member Functions

 AnnColor (float red, float green, float blue, float alpha=1.0f)
 Create a color object. Each channel take a float between 0 and 1. More...
 
 AnnColor (Ogre::ColourValue color)
 Create a color object from a Ogre::ColourValue. More...
 
 AnnColor (const AnnColor &color)
 Create a color object form a reference to another color object. More...
 
AnnColoroperator= (const AnnColor &color)
 Assignment operator overload. More...
 
Ogre::ColourValue getOgreColor () const
 Return a Ogre::ColourValue from the internal color value. More...
 
unsigned char getRedI () const
 Return the red channel as an integer between 0 and 255. More...
 
unsigned char getBlueI () const
 Return the blue channel as an integer between 0 and 255. More...
 
unsigned char getGreenI () const
 Return the green channel as an integer between 0 and 255. More...
 
unsigned char getAlphaI () const
 Return the alpha channel as an integer between 0 and 255. More...
 
float getRed () const
 Get the red value as float. More...
 
float getGreen () const
 Get the green value as float. More...
 
float getBlue () const
 Get blue red value as float. More...
 
float getAlpha () const
 Get alpha red value as float. More...
 
void setRed (float red)
 Set the red value. More...
 
void setGreen (float green)
 Set the green value. More...
 
void setBlue (float blue)
 Set the blue value. More...
 
void setAlpha (float alpha)
 Set the alpha value. More...
 

Protected Attributes

float r
 
float g
 
float b
 
float a
 

Static Private Member Functions

static unsigned char f2i (float f)
 Return f*MAX8BIT. More...
 
static bool isInFloatRange (float f)
 Return true if f is inside interval [0;1]. More...
 

Static Private Attributes

static constexpr const unsigned char MAX8BIT = 0xFF
 

Friends

AnnDllExport friend std::ostreamoperator<< (std::ostream &out, const AnnColor &color)
 Prints color object description to output stream. More...
 

Detailed Description

Class that represent a 4 channel color value.

Definition at line 17 of file AnnColor.hpp.

Constructor & Destructor Documentation

◆ AnnColor() [1/3]

AnnColor::AnnColor ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Create a color object. Each channel take a float between 0 and 1.

Definition at line 7 of file AnnColor.cpp.

◆ AnnColor() [2/3]

AnnColor::AnnColor ( Ogre::ColourValue  color)

Create a color object from a Ogre::ColourValue.

Definition at line 15 of file AnnColor.cpp.

◆ AnnColor() [3/3]

AnnColor::AnnColor ( const AnnColor color)

Create a color object form a reference to another color object.

Definition at line 23 of file AnnColor.cpp.

Member Function Documentation

◆ f2i()

unsigned char AnnColor::f2i ( float  f)
staticprivate

Return f*MAX8BIT.

Definition at line 65 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getAlpha()

float AnnColor::getAlpha ( ) const

Get alpha red value as float.

Definition at line 60 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getAlphaI()

unsigned char AnnColor::getAlphaI ( ) const

Return the alpha channel as an integer between 0 and 255.

Definition at line 85 of file AnnColor.cpp.

Here is the call graph for this function:

◆ getBlue()

float AnnColor::getBlue ( ) const

Get blue red value as float.

Definition at line 55 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getBlueI()

unsigned char AnnColor::getBlueI ( ) const

Return the blue channel as an integer between 0 and 255.

Definition at line 80 of file AnnColor.cpp.

Here is the call graph for this function:

◆ getGreen()

float AnnColor::getGreen ( ) const

Get the green value as float.

Definition at line 50 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getGreenI()

unsigned char AnnColor::getGreenI ( ) const

Return the green channel as an integer between 0 and 255.

Definition at line 75 of file AnnColor.cpp.

Here is the call graph for this function:

◆ getOgreColor()

Ogre::ColourValue AnnColor::getOgreColor ( ) const

Return a Ogre::ColourValue from the internal color value.

Definition at line 40 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getRed()

float AnnColor::getRed ( ) const

Get the red value as float.

Definition at line 45 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ getRedI()

unsigned char AnnColor::getRedI ( ) const

Return the red channel as an integer between 0 and 255.

Definition at line 70 of file AnnColor.cpp.

Here is the call graph for this function:

◆ isInFloatRange()

bool AnnColor::isInFloatRange ( float  f)
staticprivate

Return true if f is inside interval [0;1].

Definition at line 90 of file AnnColor.cpp.

Here is the caller graph for this function:

◆ operator=()

AnnColor & AnnColor::operator= ( const AnnColor color)

Assignment operator overload.

Definition at line 31 of file AnnColor.cpp.

◆ setAlpha()

void AnnColor::setAlpha ( float  alpha)

Set the alpha value.

Definition at line 113 of file AnnColor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBlue()

void AnnColor::setBlue ( float  blue)

Set the blue value.

Definition at line 107 of file AnnColor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setGreen()

void AnnColor::setGreen ( float  green)

Set the green value.

Definition at line 101 of file AnnColor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRed()

void AnnColor::setRed ( float  red)

Set the red value.

Definition at line 95 of file AnnColor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

AnnDllExport friend std::ostream& operator<< ( std::ostream out,
const AnnColor color 
)
friend

Prints color object description to output stream.

Definition at line 61 of file AnnColor.hpp.

Member Data Documentation

◆ a

float Annwvyn::AnnColor::a
protected

Definition at line 72 of file AnnColor.hpp.

◆ b

float Annwvyn::AnnColor::b
protected

Definition at line 72 of file AnnColor.hpp.

◆ g

float Annwvyn::AnnColor::g
protected

Definition at line 72 of file AnnColor.hpp.

◆ MAX8BIT

constexpr const unsigned char Annwvyn::AnnColor::MAX8BIT = 0xFF
staticprivate

Definition at line 75 of file AnnColor.hpp.

◆ r

float Annwvyn::AnnColor::r
protected

Definition at line 72 of file AnnColor.hpp.


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