raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
raylib::Color Class Reference

Public Member Functions

 Color ()
 Black. More...
 
 Color (::Vector3 hsv)
 Returns a Color from HSV values. More...
 
 Color (::Vector4 normalized)
 Returns Color from normalized values [0..1]. More...
 
 Color (const ::Color &color)
 
 Color (int hexValue)
 Get Color structure from hexadecimal value. More...
 
 Color (unsigned char red, unsigned char green, unsigned char blue)
 
 Color (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
 
Color Alpha (float alpha) const
 Returns color with alpha applied, alpha goes from 0.0f to 1.0f. More...
 
Color AlphaBlend (::Color dst, ::Color tint) const
 Returns src alpha-blended into dst color with tint. More...
 
Color & ClearBackground ()
 Set background color (framebuffer clear color) More...
 
Color & DrawLine (::Vector2 startPos, ::Vector2 endPos)
 
Color & DrawLine (::Vector2 startPos, ::Vector2 endPos, float thick)
 
Color & DrawLine (int startPosX, int startPosY, int endPosX, int endPosY)
 Draw a line. More...
 
Color & DrawLineBezier (::Vector2 startPos, ::Vector2 endPos, float thick)
 
Color & DrawLineStrip (::Vector2 *points, int numPoints)
 
Color & DrawPixel (::Vector2 pos)
 Draw a pixel. More...
 
Color & DrawPixel (int x, int y)
 
Color & DrawRectangle (::Rectangle rec)
 
Color & DrawRectangle (::Rectangle rec, ::Vector2 origin, float rotation)
 
Color & DrawRectangle (::Vector2 position, ::Vector2 size)
 
Color & DrawRectangle (int posX, int posY, int width, int height)
 
Color & DrawRectangleLines (::Rectangle rec, int lineThick)
 
Color & DrawRectangleLines (int posX, int posY, int width, int height)
 
Color & DrawText (const ::Font &font, const std::string &text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap=false)
 
Color & DrawText (const ::Font &font, const std::string &text, ::Vector2 position, float fontSize, float spacing)
 
Color & DrawText (const std::string &text, int posX, int posY, int fontSize)
 
Color Fade (float alpha) const
 Returns color with alpha applied, alpha goes from 0.0f to 1.0f. More...
 
unsigned char GetA () const
 
unsigned char GetB () const
 
unsigned char GetG () const
 
unsigned char GetR () const
 
Vector4 Normalize () const
 Returns Color normalized as float [0..1]. More...
 
 operator int () const
 Returns hexadecimal value for a Color. More...
 
Color & operator= (const ::Color &color)
 
void SetA (unsigned char value)
 
void SetB (unsigned char value)
 
void SetG (unsigned char value)
 
void SetR (unsigned char value)
 
Vector3 ToHSV () const
 Returns HSV values for a Color. More...
 
int ToInt () const
 Returns hexadecimal value for a Color. More...
 

Static Public Member Functions

static Color Beige ()
 
static Color Black ()
 
static Color Blank ()
 
static Color Blue ()
 
static Color Brown ()
 
static Color DarkBlue ()
 
static Color DarkBrown ()
 
static Color DarkGray ()
 
static Color DarkGreen ()
 
static Color DarkPurple ()
 
::Color FromHSV (float hue, float saturation, float value)
 Returns a Color from HSV values. More...
 
static Color Gold ()
 
static Color Gray ()
 
static Color Green ()
 
static Color LightGray ()
 
static Color Lime ()
 
static Color Magenta ()
 
static Color Maroon ()
 
static Color Orange ()
 
static Color Pink ()
 
static Color Purple ()
 
static Color RayWhite ()
 
static Color Red ()
 
static Color SkyBlue ()
 
static Color Violet ()
 
static Color White ()
 
static Color Yellow ()
 

Protected Member Functions

void set (const ::Color &color)
 

Detailed Description

Definition at line 35 of file Color.hpp.

Constructor & Destructor Documentation

◆ Color() [1/7]

raylib::Color::Color ( const ::Color &  color)
inline

Definition at line 37 of file Color.hpp.

References set().

◆ Color() [2/7]

raylib::Color::Color ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha 
)
inline

Definition at line 41 of file Color.hpp.

◆ Color() [3/7]

raylib::Color::Color ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)
inline

Definition at line 44 of file Color.hpp.

◆ Color() [4/7]

raylib::Color::Color ( )
inline

Black.

Definition at line 50 of file Color.hpp.

◆ Color() [5/7]

raylib::Color::Color ( ::Vector3  hsv)
inline

Returns a Color from HSV values.

Definition at line 55 of file Color.hpp.

References set().

◆ Color() [6/7]

raylib::Color::Color ( int  hexValue)
inline

Get Color structure from hexadecimal value.

Definition at line 69 of file Color.hpp.

References set().

◆ Color() [7/7]

raylib::Color::Color ( ::Vector4  normalized)
inline

Returns Color from normalized values [0..1].

Definition at line 76 of file Color.hpp.

References set().

Member Function Documentation

◆ Alpha()

Color raylib::Color::Alpha ( float  alpha) const
inline

Returns color with alpha applied, alpha goes from 0.0f to 1.0f.

Definition at line 229 of file Color.hpp.

◆ AlphaBlend()

Color raylib::Color::AlphaBlend ( ::Color  dst,
::Color  tint 
) const
inline

Returns src alpha-blended into dst color with tint.

Definition at line 236 of file Color.hpp.

◆ Beige()

static Color raylib::Color::Beige ( )
inlinestatic

Definition at line 258 of file Color.hpp.

◆ Black()

static Color raylib::Color::Black ( )
inlinestatic

Definition at line 262 of file Color.hpp.

◆ Blank()

static Color raylib::Color::Blank ( )
inlinestatic

Definition at line 263 of file Color.hpp.

◆ Blue()

static Color raylib::Color::Blue ( )
inlinestatic

Definition at line 253 of file Color.hpp.

◆ Brown()

static Color raylib::Color::Brown ( )
inlinestatic

Definition at line 259 of file Color.hpp.

◆ ClearBackground()

Color& raylib::Color::ClearBackground ( )
inline

Set background color (framebuffer clear color)

Definition at line 128 of file Color.hpp.

◆ DarkBlue()

static Color raylib::Color::DarkBlue ( )
inlinestatic

Definition at line 254 of file Color.hpp.

◆ DarkBrown()

static Color raylib::Color::DarkBrown ( )
inlinestatic

Definition at line 260 of file Color.hpp.

◆ DarkGray()

static Color raylib::Color::DarkGray ( )
inlinestatic

Definition at line 242 of file Color.hpp.

◆ DarkGreen()

static Color raylib::Color::DarkGreen ( )
inlinestatic

Definition at line 251 of file Color.hpp.

◆ DarkPurple()

static Color raylib::Color::DarkPurple ( )
inlinestatic

Definition at line 257 of file Color.hpp.

◆ DrawLine() [1/3]

Color& raylib::Color::DrawLine ( ::Vector2  startPos,
::Vector2  endPos 
)
inline

Definition at line 154 of file Color.hpp.

◆ DrawLine() [2/3]

Color& raylib::Color::DrawLine ( ::Vector2  startPos,
::Vector2  endPos,
float  thick 
)
inline

Definition at line 159 of file Color.hpp.

◆ DrawLine() [3/3]

Color& raylib::Color::DrawLine ( int  startPosX,
int  startPosY,
int  endPosX,
int  endPosY 
)
inline

Draw a line.

Definition at line 149 of file Color.hpp.

◆ DrawLineBezier()

Color& raylib::Color::DrawLineBezier ( ::Vector2  startPos,
::Vector2  endPos,
float  thick 
)
inline

Definition at line 164 of file Color.hpp.

◆ DrawLineStrip()

Color& raylib::Color::DrawLineStrip ( ::Vector2 *  points,
int  numPoints 
)
inline

Definition at line 169 of file Color.hpp.

◆ DrawPixel() [1/2]

Color& raylib::Color::DrawPixel ( ::Vector2  pos)
inline

Draw a pixel.

Definition at line 141 of file Color.hpp.

◆ DrawPixel() [2/2]

Color& raylib::Color::DrawPixel ( int  x,
int  y 
)
inline

Definition at line 133 of file Color.hpp.

◆ DrawRectangle() [1/4]

Color& raylib::Color::DrawRectangle ( ::Rectangle  rec)
inline

Definition at line 206 of file Color.hpp.

◆ DrawRectangle() [2/4]

Color& raylib::Color::DrawRectangle ( ::Rectangle  rec,
::Vector2  origin,
float  rotation 
)
inline

Definition at line 211 of file Color.hpp.

◆ DrawRectangle() [3/4]

Color& raylib::Color::DrawRectangle ( ::Vector2  position,
::Vector2  size 
)
inline

Definition at line 201 of file Color.hpp.

◆ DrawRectangle() [4/4]

Color& raylib::Color::DrawRectangle ( int  posX,
int  posY,
int  width,
int  height 
)
inline

Definition at line 196 of file Color.hpp.

◆ DrawRectangleLines() [1/2]

Color& raylib::Color::DrawRectangleLines ( ::Rectangle  rec,
int  lineThick 
)
inline

Definition at line 221 of file Color.hpp.

◆ DrawRectangleLines() [2/2]

Color& raylib::Color::DrawRectangleLines ( int  posX,
int  posY,
int  width,
int  height 
)
inline

Definition at line 216 of file Color.hpp.

◆ DrawText() [1/3]

Color& raylib::Color::DrawText ( const ::Font &  font,
const std::string &  text,
::Rectangle  rec,
float  fontSize,
float  spacing,
bool  wordWrap = false 
)
inline

Definition at line 185 of file Color.hpp.

◆ DrawText() [2/3]

Color& raylib::Color::DrawText ( const ::Font &  font,
const std::string &  text,
::Vector2  position,
float  fontSize,
float  spacing 
)
inline

Definition at line 179 of file Color.hpp.

◆ DrawText() [3/3]

Color& raylib::Color::DrawText ( const std::string &  text,
int  posX,
int  posY,
int  fontSize 
)
inline

Definition at line 174 of file Color.hpp.

◆ Fade()

Color raylib::Color::Fade ( float  alpha) const
inline

Returns color with alpha applied, alpha goes from 0.0f to 1.0f.

Definition at line 97 of file Color.hpp.

◆ FromHSV()

::Color raylib::Color::FromHSV ( float  hue,
float  saturation,
float  value 
)
inlinestatic

Returns a Color from HSV values.

Definition at line 62 of file Color.hpp.

◆ GetA()

unsigned char raylib::Color::GetA ( ) const
inline

Definition at line 118 of file Color.hpp.

◆ GetB()

unsigned char raylib::Color::GetB ( ) const
inline

Definition at line 117 of file Color.hpp.

◆ GetG()

unsigned char raylib::Color::GetG ( ) const
inline

Definition at line 116 of file Color.hpp.

◆ GetR()

unsigned char raylib::Color::GetR ( ) const
inline

Definition at line 115 of file Color.hpp.

◆ Gold()

static Color raylib::Color::Gold ( )
inlinestatic

Definition at line 244 of file Color.hpp.

◆ Gray()

static Color raylib::Color::Gray ( )
inlinestatic

Definition at line 241 of file Color.hpp.

◆ Green()

static Color raylib::Color::Green ( )
inlinestatic

Definition at line 249 of file Color.hpp.

◆ LightGray()

static Color raylib::Color::LightGray ( )
inlinestatic

Definition at line 240 of file Color.hpp.

◆ Lime()

static Color raylib::Color::Lime ( )
inlinestatic

Definition at line 250 of file Color.hpp.

◆ Magenta()

static Color raylib::Color::Magenta ( )
inlinestatic

Definition at line 264 of file Color.hpp.

◆ Maroon()

static Color raylib::Color::Maroon ( )
inlinestatic

Definition at line 248 of file Color.hpp.

◆ Normalize()

Vector4 raylib::Color::Normalize ( ) const
inline

Returns Color normalized as float [0..1].

Definition at line 104 of file Color.hpp.

◆ operator int()

raylib::Color::operator int ( ) const
inline

Returns hexadecimal value for a Color.

Definition at line 90 of file Color.hpp.

◆ operator=()

Color& raylib::Color::operator= ( const ::Color &  color)
inline

Definition at line 120 of file Color.hpp.

References set().

◆ Orange()

static Color raylib::Color::Orange ( )
inlinestatic

Definition at line 245 of file Color.hpp.

◆ Pink()

static Color raylib::Color::Pink ( )
inlinestatic

Definition at line 246 of file Color.hpp.

◆ Purple()

static Color raylib::Color::Purple ( )
inlinestatic

Definition at line 255 of file Color.hpp.

◆ RayWhite()

static Color raylib::Color::RayWhite ( )
inlinestatic

Definition at line 265 of file Color.hpp.

◆ Red()

static Color raylib::Color::Red ( )
inlinestatic

Definition at line 247 of file Color.hpp.

◆ set()

void raylib::Color::set ( const ::Color &  color)
inlineprotected

Definition at line 268 of file Color.hpp.

Referenced by Color(), and operator=().

◆ SetA()

void raylib::Color::SetA ( unsigned char  value)
inline

Definition at line 118 of file Color.hpp.

◆ SetB()

void raylib::Color::SetB ( unsigned char  value)
inline

Definition at line 117 of file Color.hpp.

◆ SetG()

void raylib::Color::SetG ( unsigned char  value)
inline

Definition at line 116 of file Color.hpp.

◆ SetR()

void raylib::Color::SetR ( unsigned char  value)
inline

Definition at line 115 of file Color.hpp.

◆ SkyBlue()

static Color raylib::Color::SkyBlue ( )
inlinestatic

Definition at line 252 of file Color.hpp.

◆ ToHSV()

Vector3 raylib::Color::ToHSV ( ) const
inline

Returns HSV values for a Color.

Definition at line 111 of file Color.hpp.

◆ ToInt()

int raylib::Color::ToInt ( ) const
inline

Returns hexadecimal value for a Color.

Definition at line 83 of file Color.hpp.

◆ Violet()

static Color raylib::Color::Violet ( )
inlinestatic

Definition at line 256 of file Color.hpp.

◆ White()

static Color raylib::Color::White ( )
inlinestatic

Definition at line 261 of file Color.hpp.

◆ Yellow()

static Color raylib::Color::Yellow ( )
inlinestatic

Definition at line 243 of file Color.hpp.