bpp-core  2.2.0
bpp::RGBColor Class Reference

Describe a color according to its red, green and blue componants. More...

#include <Bpp/Graphics/RgbColor.h>

+ Inheritance diagram for bpp::RGBColor:
+ Collaboration diagram for bpp::RGBColor:

Public Member Functions

 RGBColor (unsigned int red, unsigned int green, unsigned int blue)
 
 RGBColor ()
 
virtual ~RGBColor ()
 
RGBColorclone () const
 Create a copy of this object and send a pointer to it. More...
 
bool operator== (const RGBColor &color) const
 
bool operator< (const RGBColor &color) const
 Comparison operator (for sorting purposes). More...
 
std::string toHex () const
 Get the HTML-like, hexadecimal description of this color. More...
 
const unsigned int & operator[] (unsigned int i) const
 Access to each color componant: 0=red, 1=green, 2=blue. More...
 
unsigned int & operator[] (unsigned int i)
 Access to each color componant: 0=red, 1=green, 2=blue. More...
 
std::string toString () const
 Get a string description of the color, e.g. [R255,G0,B255]. More...
 

Static Protected Member Functions

static std::string decToHex (unsigned int dec)
 

Protected Attributes

unsigned int red_
 
unsigned int green_
 
unsigned int blue_
 

Detailed Description

Describe a color according to its red, green and blue componants.

Definition at line 56 of file RgbColor.h.

Constructor & Destructor Documentation

◆ RGBColor() [1/2]

bpp::RGBColor::RGBColor ( unsigned int  red,
unsigned int  green,
unsigned int  blue 
)
inline

Definition at line 65 of file RgbColor.h.

◆ RGBColor() [2/2]

bpp::RGBColor::RGBColor ( )
inline

Definition at line 66 of file RgbColor.h.

Referenced by clone().

◆ ~RGBColor()

virtual bpp::RGBColor::~RGBColor ( )
inlinevirtual

Definition at line 67 of file RgbColor.h.

Member Function Documentation

◆ clone()

RGBColor* bpp::RGBColor::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 74 of file RgbColor.h.

References RGBColor().

◆ decToHex()

static std::string bpp::RGBColor::decToHex ( unsigned int  dec)
inlinestaticprotected

Definition at line 137 of file RgbColor.h.

Referenced by toHex().

◆ operator<()

bool bpp::RGBColor::operator< ( const RGBColor color) const
inline

Comparison operator (for sorting purposes).

The hexadecimal string representation is used for comparison.

Parameters
colorThe color to compare with.

Definition at line 89 of file RgbColor.h.

References toHex().

◆ operator==()

bool bpp::RGBColor::operator== ( const RGBColor color) const
inline

Definition at line 77 of file RgbColor.h.

References blue_, green_, and red_.

◆ operator[]() [1/2]

const unsigned int& bpp::RGBColor::operator[] ( unsigned int  i) const
inline

Access to each color componant: 0=red, 1=green, 2=blue.

Definition at line 109 of file RgbColor.h.

References blue_, green_, and red_.

◆ operator[]() [2/2]

unsigned int& bpp::RGBColor::operator[] ( unsigned int  i)
inline

Access to each color componant: 0=red, 1=green, 2=blue.

Definition at line 120 of file RgbColor.h.

References blue_, green_, and red_.

◆ toHex()

std::string bpp::RGBColor::toHex ( ) const
inline

Get the HTML-like, hexadecimal description of this color.

Definition at line 97 of file RgbColor.h.

References blue_, decToHex(), green_, and red_.

Referenced by operator<().

◆ toString()

std::string bpp::RGBColor::toString ( ) const
inline

Get a string description of the color, e.g. [R255,G0,B255].

Definition at line 131 of file RgbColor.h.

References blue_, green_, red_, and bpp::TextTools::toString().

Member Data Documentation

◆ blue_

unsigned int bpp::RGBColor::blue_
protected

Definition at line 62 of file RgbColor.h.

Referenced by operator==(), operator[](), toHex(), and toString().

◆ green_

unsigned int bpp::RGBColor::green_
protected

Definition at line 61 of file RgbColor.h.

Referenced by operator==(), operator[](), toHex(), and toString().

◆ red_

unsigned int bpp::RGBColor::red_
protected

Definition at line 60 of file RgbColor.h.

Referenced by operator==(), operator[](), toHex(), and toString().


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