Raylib C++  1.0.0
Encapsulates the raylib library
Public Member Functions | Static Public Attributes | List of all members
raylib::RlColor Class Reference

Encapsulation of the raylib Color. More...

#include <RlColor.hpp>

Collaboration diagram for raylib::RlColor:
Collaboration graph

Public Member Functions

 RlColor (Color color)
 Construct an RlColor from Raylib's Color. More...
 
 RlColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 Construct an RlColor from RGBA values. More...
 
 RlColor (std::uint32_t color)
 Construct the color from 32-bit unsigned integer. More...
 
 RlColor (const Vector4f &normalizedColor)
 Get color from normalized values [0..1]. More...
 
 RlColor (float hue, float saturation, float value)
 Create a RlColor from HSV values, hue [0..360], saturation/value [0..1]. More...
 
void alpha (float alpha)
 Apply alpha to the color, alpha goes from 0.0f to 1.0f. More...
 
Vector3f toHSV ()
 Returns HSV values for a Color, hue [0..360], saturation/value [0..1]. More...
 
std::uint32_t toInteger () const
 Retrieve the color as a 32-bit unsigned integer (hexadecimal) More...
 
Vector4f normalize () const
 Normalize the color to [0..1]. More...
 
void alphaBlend (const RlColor &src, const RlColor &tint)
 Blend src into this color with tint. More...
 
const Color & getColor () const
 Get the Raylib's Color. More...
 
const unsigned char & getRed () const
 Get the red value. More...
 
const unsigned char & getGreen () const
 Get the green value. More...
 
const unsigned char & getBlue () const
 Get the blue value. More...
 
const unsigned char & getAlpha () const
 Get the alpha value. More...
 
void setColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 Set the rgba color. More...
 
RlColorsetRed (unsigned char r)
 Set the red value. More...
 
RlColorsetGreen (unsigned char g)
 Set the green value. More...
 
RlColorsetBlue (unsigned char b)
 Set the blue value. More...
 
RlColorsetAlpha (unsigned char a)
 Set the alpha value. More...
 
void setColor (const Color &color)
 Set the color from the raylib color. More...
 
bool operator== (const RlColor &other) const
 Check equality between two colors. More...
 
bool operator!= (const RlColor &other) const
 Check inequality between two colors. More...
 
RlColoroperator- (unsigned char value)
 Remove the value to all the color components. More...
 
RlColoroperator+ (unsigned char value)
 Add the value to all the color components. More...
 
RlColoroperator-= (unsigned char value)
 Remove the value to all the color components. More...
 
RlColoroperator+= (unsigned char value)
 Add the value to all the color components. More...
 

Static Public Attributes

static const RlColor LightGray = raylib::RlColor(200, 200, 200, 255)
 
static const RlColor Gray = raylib::RlColor(130, 130, 130, 255)
 
static const RlColor DarkGray = raylib::RlColor(80, 80, 80, 255)
 
static const RlColor Yellow = raylib::RlColor(253, 249, 0, 255)
 
static const RlColor Gold = raylib::RlColor(255, 203, 0, 255)
 
static const RlColor Orange = raylib::RlColor(255, 161, 0, 255)
 
static const RlColor Pink = raylib::RlColor(255, 109, 194, 255)
 
static const RlColor Red = raylib::RlColor(230, 41, 55, 255)
 
static const RlColor Maroon = raylib::RlColor(190, 33, 55, 255)
 
static const RlColor Green = raylib::RlColor(0, 228, 48, 255)
 
static const RlColor Lime = raylib::RlColor(0, 158, 47, 255)
 
static const RlColor DarkGreen = raylib::RlColor(0, 117, 44, 255)
 
static const RlColor SkyBlue = raylib::RlColor(102, 191, 255, 255)
 
static const RlColor Blue = raylib::RlColor(0, 121, 241, 255)
 
static const RlColor DarkBlue = raylib::RlColor(0, 82, 172, 255)
 
static const RlColor Purple = raylib::RlColor(200, 122, 255, 255)
 
static const RlColor Violet = raylib::RlColor(135, 60, 190, 255)
 
static const RlColor DarkPurple = raylib::RlColor(112, 31, 126, 255)
 
static const RlColor Beige = raylib::RlColor(211, 176, 131, 255)
 
static const RlColor Brown = raylib::RlColor(127, 106, 79, 255)
 
static const RlColor DarkBrown = raylib::RlColor(76, 63, 47, 255)
 
static const RlColor White = raylib::RlColor(255, 255, 255, 255)
 
static const RlColor Black = raylib::RlColor(0, 0, 0, 255)
 
static const RlColor Transparent = raylib::RlColor(0, 0, 0, 0)
 
static const RlColor Magenta = raylib::RlColor(255, 0, 255, 255)
 
static const RlColor RayWhite = raylib::RlColor(245, 245, 245, 255)
 

Detailed Description

Encapsulation of the raylib Color.

Constructor & Destructor Documentation

◆ RlColor() [1/5]

raylib::RlColor::RlColor ( Color  color)
explicit

Construct an RlColor from Raylib's Color.

Parameters
colorthe Raylib's Color

◆ RlColor() [2/5]

raylib::RlColor::RlColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
explicit

Construct an RlColor from RGBA values.

Parameters
rthe red value
gthe green value
bthe blue value
athe alpha value

◆ RlColor() [3/5]

raylib::RlColor::RlColor ( std::uint32_t  color)
explicit

Construct the color from 32-bit unsigned integer.

Parameters
colorNumber containing the RGBA components (in that order)

◆ RlColor() [4/5]

raylib::RlColor::RlColor ( const Vector4f normalizedColor)
explicit

Get color from normalized values [0..1].

Parameters
normalizedColorthe normalized color

◆ RlColor() [5/5]

raylib::RlColor::RlColor ( float  hue,
float  saturation,
float  value 
)
explicit

Create a RlColor from HSV values, hue [0..360], saturation/value [0..1].

Parameters
hueto convert
saturationto convert
valueto convert

Member Function Documentation

◆ alpha()

void raylib::RlColor::alpha ( float  alpha)

Apply alpha to the color, alpha goes from 0.0f to 1.0f.

Parameters
alphato apply

◆ alphaBlend()

void raylib::RlColor::alphaBlend ( const RlColor src,
const RlColor tint 
)

Blend src into this color with tint.

Parameters
srcthe color to apply alpha to
tintthe color to apply

◆ getAlpha()

const unsigned char & raylib::RlColor::getAlpha ( ) const

Get the alpha value.

Returns
the alpha value
Here is the caller graph for this function:

◆ getBlue()

const unsigned char & raylib::RlColor::getBlue ( ) const

Get the blue value.

Returns
the blue value
Here is the caller graph for this function:

◆ getColor()

const Color & raylib::RlColor::getColor ( ) const

Get the Raylib's Color.

Returns
the Raylib's Color
Here is the caller graph for this function:

◆ getGreen()

const unsigned char & raylib::RlColor::getGreen ( ) const

Get the green value.

Returns
the green value
Here is the caller graph for this function:

◆ getRed()

const unsigned char & raylib::RlColor::getRed ( ) const

Get the red value.

Returns
the red value
Here is the caller graph for this function:

◆ normalize()

Vector4f raylib::RlColor::normalize ( ) const

Normalize the color to [0..1].

Returns
the normalized color

◆ operator!=()

bool raylib::RlColor::operator!= ( const RlColor other) const

Check inequality between two colors.

Parameters
otheranother color
Returns
true if the two color are not equal, false otherwise

◆ operator+()

RlColor & raylib::RlColor::operator+ ( unsigned char  value)

Add the value to all the color components.

Parameters
valuethe value to add
Returns
this

◆ operator+=()

RlColor & raylib::RlColor::operator+= ( unsigned char  value)

Add the value to all the color components.

Parameters
valuethe value to add
Returns
this

◆ operator-()

raylib::RlColor & raylib::RlColor::operator- ( unsigned char  value)

Remove the value to all the color components.

Parameters
valuethe value to remove
Returns
this

◆ operator-=()

RlColor & raylib::RlColor::operator-= ( unsigned char  value)

Remove the value to all the color components.

Parameters
valuethe value to remove
Returns
this

◆ operator==()

bool raylib::RlColor::operator== ( const RlColor other) const

Check equality between two colors.

Parameters
otheranother color
Returns
true if the two color are equal, false otherwise
Here is the call graph for this function:

◆ setAlpha()

raylib::RlColor & raylib::RlColor::setAlpha ( unsigned char  a)

Set the alpha value.

Parameters
athe alpha value
Returns
this

◆ setBlue()

raylib::RlColor & raylib::RlColor::setBlue ( unsigned char  b)

Set the blue value.

Parameters
bthe blue value
Returns
this

◆ setColor() [1/2]

void raylib::RlColor::setColor ( const Color &  color)

Set the color from the raylib color.

Parameters
colorthe raylib color

◆ setColor() [2/2]

void raylib::RlColor::setColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

Set the rgba color.

Parameters
rthe red value
gthe green value
bthe blue value
athe alpha value

◆ setGreen()

raylib::RlColor & raylib::RlColor::setGreen ( unsigned char  g)

Set the green value.

Parameters
gthe green value
Returns
this

◆ setRed()

raylib::RlColor & raylib::RlColor::setRed ( unsigned char  r)

Set the red value.

Parameters
rthe red value
Returns
this

◆ toHSV()

Vector3f raylib::RlColor::toHSV ( )

Returns HSV values for a Color, hue [0..360], saturation/value [0..1].

Returns
the HSV values for a Color
Here is the call graph for this function:

◆ toInteger()

std::uint32_t raylib::RlColor::toInteger ( ) const

Retrieve the color as a 32-bit unsigned integer (hexadecimal)

Returns
Color represented as a 32-bit unsigned integer (hexadecimal)

Member Data Documentation

◆ Beige

const raylib::RlColor raylib::RlColor::Beige = raylib::RlColor(211, 176, 131, 255)
static

Beige

◆ Black

const raylib::RlColor raylib::RlColor::Black = raylib::RlColor(0, 0, 0, 255)
static

Black

◆ Blue

const raylib::RlColor raylib::RlColor::Blue = raylib::RlColor(0, 121, 241, 255)
static

Blue

◆ Brown

const raylib::RlColor raylib::RlColor::Brown = raylib::RlColor(127, 106, 79, 255)
static

Brown

◆ DarkBlue

const raylib::RlColor raylib::RlColor::DarkBlue = raylib::RlColor(0, 82, 172, 255)
static

Dark Blue

◆ DarkBrown

const raylib::RlColor raylib::RlColor::DarkBrown = raylib::RlColor(76, 63, 47, 255)
static

Dark Brown

◆ DarkGray

const raylib::RlColor raylib::RlColor::DarkGray = raylib::RlColor(80, 80, 80, 255)
static

Dark Gray

◆ DarkGreen

const raylib::RlColor raylib::RlColor::DarkGreen = raylib::RlColor(0, 117, 44, 255)
static

Dark Green

◆ DarkPurple

const raylib::RlColor raylib::RlColor::DarkPurple = raylib::RlColor(112, 31, 126, 255)
static

Dark Purple

◆ Gold

const raylib::RlColor raylib::RlColor::Gold = raylib::RlColor(255, 203, 0, 255)
static

Gold

◆ Gray

const raylib::RlColor raylib::RlColor::Gray = raylib::RlColor(130, 130, 130, 255)
static

Gray

◆ Green

const raylib::RlColor raylib::RlColor::Green = raylib::RlColor(0, 228, 48, 255)
static

Green

◆ LightGray

const raylib::RlColor raylib::RlColor::LightGray = raylib::RlColor(200, 200, 200, 255)
static

Light Gray

◆ Lime

const raylib::RlColor raylib::RlColor::Lime = raylib::RlColor(0, 158, 47, 255)
static

Lime

◆ Magenta

const raylib::RlColor raylib::RlColor::Magenta = raylib::RlColor(255, 0, 255, 255)
static

Magenta

◆ Maroon

const raylib::RlColor raylib::RlColor::Maroon = raylib::RlColor(190, 33, 55, 255)
static

Maroon

◆ Orange

const raylib::RlColor raylib::RlColor::Orange = raylib::RlColor(255, 161, 0, 255)
static

Orange

◆ Pink

const raylib::RlColor raylib::RlColor::Pink = raylib::RlColor(255, 109, 194, 255)
static

Pink

◆ Purple

const raylib::RlColor raylib::RlColor::Purple = raylib::RlColor(200, 122, 255, 255)
static

Purple

◆ RayWhite

const raylib::RlColor raylib::RlColor::RayWhite = raylib::RlColor(245, 245, 245, 255)
static

Raylib White

◆ Red

const raylib::RlColor raylib::RlColor::Red = raylib::RlColor(230, 41, 55, 255)
static

Red

◆ SkyBlue

const raylib::RlColor raylib::RlColor::SkyBlue = raylib::RlColor(102, 191, 255, 255)
static

Sky Blue

◆ Transparent

const raylib::RlColor raylib::RlColor::Transparent = raylib::RlColor(0, 0, 0, 0)
static

Transparent (Blank)

◆ Violet

const raylib::RlColor raylib::RlColor::Violet = raylib::RlColor(135, 60, 190, 255)
static

Violet

◆ White

const raylib::RlColor raylib::RlColor::White = raylib::RlColor(255, 255, 255, 255)
static

White

◆ Yellow

const raylib::RlColor raylib::RlColor::Yellow = raylib::RlColor(253, 249, 0, 255)
static

Yellow


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