hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
hx3d::graphics::Color Class Reference

Four [0..255] components defined color. More...

#include <color.hpp>

Public Member Functions

 Color ()
 Create a white color.
 
 Color (unsigned char r, unsigned char g, unsigned char b)
 Create a color with an alpha of 255. More...
 
 Color (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 Create a color with a custom alpha. More...
 
Coloroperator= (const Color &color)
 Affect a color into another. More...
 
glm::vec4 toFloat ()
 Convert the color to a float format (between 0 and 1). More...
 

Static Public Member Functions

static Color hsvToRgb (Color hsv)
 Convert HSV color to RGB format. More...
 
static Color rgbToHsv (Color rgb)
 Convert RGB color to HSV format. More...
 

Public Attributes

unsigned char r
 Red component.
 
unsigned char g
 Green component.
 
unsigned char b
 Blue component.
 
unsigned char a
 Alpha component.
 

Static Public Attributes

static Color White = Color(255, 255, 255)
 White color.
 
static Color Black = Color(0, 0, 0)
 Black color.
 
static Color Red = Color(255, 0, 0)
 Red color.
 
static Color Green = Color(0, 255, 0)
 Green color.
 
static Color Blue = Color(0, 0, 255)
 Blue color.
 

Detailed Description

Four [0..255] components defined color.

Definition at line 32 of file color.hpp.

Constructor & Destructor Documentation

hx3d::graphics::Color::Color ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Create a color with an alpha of 255.

Parameters
rRed
gGreen
bBlue

Definition at line 28 of file color.cpp.

hx3d::graphics::Color::Color ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

Create a color with a custom alpha.

Parameters
rRed
gGreen
bBlue
aAlpha

Definition at line 30 of file color.cpp.

Member Function Documentation

Color hx3d::graphics::Color::hsvToRgb ( Color  hsv)
static

Convert HSV color to RGB format.

Parameters
hsvHSV color
Returns
RGB color

Definition at line 46 of file color.cpp.

Color & hx3d::graphics::Color::operator= ( const Color color)

Affect a color into another.

Parameters
colorAnothe color
Returns
Color

Definition at line 33 of file color.cpp.

Color hx3d::graphics::Color::rgbToHsv ( Color  rgb)
static

Convert RGB color to HSV format.

Parameters
rgbRGB color
Returns
HSV color

Definition at line 91 of file color.cpp.

glm::vec4 hx3d::graphics::Color::toFloat ( )

Convert the color to a float format (between 0 and 1).

Returns
Color (vec4)

Definition at line 42 of file color.cpp.


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