bpp-core3  3.0.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 21 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 30 of file RgbColor.h.

◆ RGBColor() [2/2]

bpp::RGBColor::RGBColor ( )
inline

Definition at line 31 of file RgbColor.h.

Referenced by clone().

◆ ~RGBColor()

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

Definition at line 32 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 34 of file RgbColor.h.

References RGBColor().

◆ decToHex()

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

Definition at line 97 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 49 of file RgbColor.h.

References toHex().

◆ operator==()

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

Definition at line 37 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 69 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 80 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 57 of file RgbColor.h.

References decToHex().

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 91 of file RgbColor.h.

References bpp::TextTools::toString().

Member Data Documentation

◆ blue_

unsigned int bpp::RGBColor::blue_
protected

Definition at line 27 of file RgbColor.h.

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

◆ green_

unsigned int bpp::RGBColor::green_
protected

Definition at line 26 of file RgbColor.h.

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

◆ red_

unsigned int bpp::RGBColor::red_
protected

Definition at line 25 of file RgbColor.h.

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


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