Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Color Class Reference

Core class that represents a color. More...

Public Member Functions

 Color ()
 Constructs a Color object by default.
 
 Color (UInt8 red, UInt8 green, UInt8 blue, UInt8 alpha=255)
 Constructs a Color object with values. More...
 
 Color (UInt8 lightness)
 Constructs a Color object with a light level. More...
 
 Color (UInt8 color[3], UInt8 alpha=255)
 Constructs a Color object with values. More...
 
 Color (const Color &color)=default
 
bool IsOpaque () const
 Return true is the color has no degree of transparency. More...
 
String ToString () const
 Converts this to string. More...
 
Color operator+ (const Color &angles) const
 Adds two colors together. More...
 
Color operator* (const Color &angles) const
 Multiplies two colors together. More...
 
Color operator+= (const Color &angles)
 Adds the color to this. More...
 
Color operator*= (const Color &angles)
 Multiplies the color to this. More...
 
bool operator== (const Color &angles) const
 Checks whether the two colors are equal. More...
 
bool operator!= (const Color &angles) const
 Checks whether the two colors are equal. More...
 

Static Public Member Functions

static Color FromCMY (float cyan, float magenta, float yellow)
 Converts CMY representation to RGB. More...
 
static Color FromCMYK (float cyan, float magenta, float yellow, float black)
 Converts CMYK representation to RGB. More...
 
static Color FromHSL (UInt8 hue, UInt8 saturation, UInt8 lightness)
 Converts HSL representation to RGB. More...
 
static Color FromHSV (float hue, float saturation, float value)
 Converts HSV representation to RGB. More...
 
static Color FromXYZ (const Vector3f &vec)
 Converts XYZ representation to RGB. More...
 
static Color FromXYZ (float x, float y, float z)
 Converts XYZ representation to RGB. More...
 
static void ToCMY (const Color &color, float *cyan, float *magenta, float *yellow)
 Converts RGB representation to CMYK. More...
 
static void ToCMYK (const Color &color, float *cyan, float *magenta, float *yellow, float *black)
 Converts RGB representation to CMYK. More...
 
static void ToHSL (const Color &color, UInt8 *hue, UInt8 *saturation, UInt8 *lightness)
 Converts RGB representation to HSL. More...
 
static void ToHSV (const Color &color, float *hue, float *saturation, float *value)
 Converts RGB representation to HSV. More...
 
static void ToXYZ (const Color &color, Vector3f *vec)
 Converts RGB representation to XYZ. More...
 
static void ToXYZ (const Color &color, float *x, float *y, float *z)
 Converts RGB representation to XYZ. More...
 

Public Attributes

UInt8 r
 
UInt8 g
 
UInt8 b
 
UInt8 a
 

Static Public Attributes

static NAZARA_CORE_API const Color Black
 
static NAZARA_CORE_API const Color Blue
 
static NAZARA_CORE_API const Color Cyan
 
static NAZARA_CORE_API const Color Green
 
static NAZARA_CORE_API const Color Magenta
 
static NAZARA_CORE_API const Color Orange
 
static NAZARA_CORE_API const Color Red
 
static NAZARA_CORE_API const Color Yellow
 
static NAZARA_CORE_API const Color White
 

Detailed Description

Core class that represents a color.

Constructor & Destructor Documentation

◆ Color() [1/3]

Nz::Color::Color ( UInt8  red,
UInt8  green,
UInt8  blue,
UInt8  alpha = 255 
)
inline

Constructs a Color object with values.

Parameters
redRed value
greenGreen value
blueBlue value
alphaAlpha value

◆ Color() [2/3]

Nz::Color::Color ( UInt8  lightness)
inlineexplicit

Constructs a Color object with a light level.

Parameters
lightnessValue for r, g and b

◆ Color() [3/3]

Nz::Color::Color ( UInt8  vec[3],
UInt8  alpha = 255 
)
inline

Constructs a Color object with values.

Parameters
vec[3]vec[0] = red value, vec[1] = green value, vec[2] = blue value
alphaAlpha value

Member Function Documentation

◆ FromCMY()

Color Nz::Color::FromCMY ( float  cyan,
float  magenta,
float  yellow 
)
inlinestatic

Converts CMY representation to RGB.

Returns
Color resulting
Parameters
cyanCyan component
magentaMagenta component
yellowYellow component

◆ FromCMYK()

Color Nz::Color::FromCMYK ( float  cyan,
float  magenta,
float  yellow,
float  black 
)
inlinestatic

Converts CMYK representation to RGB.

Returns
Color resulting
Parameters
cyanCyan component
magentaMagenta component
yellowYellow component
blackBlack component

◆ FromHSL()

Color Nz::Color::FromHSL ( UInt8  hue,
UInt8  saturation,
UInt8  lightness 
)
inlinestatic

Converts HSL representation to RGB.

Returns
Color resulting
Parameters
hueHue component
saturationSaturation component
lightnessLightness component

◆ FromHSV()

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

Converts HSV representation to RGB.

Returns
Color resulting
Parameters
hueHue component
saturationSaturation component
valueValue component

◆ FromXYZ() [1/2]

Color Nz::Color::FromXYZ ( const Vector3f vec)
inlinestatic

Converts XYZ representation to RGB.

Returns
Color resulting
Parameters
vecVector3 representing the space color

◆ FromXYZ() [2/2]

Color Nz::Color::FromXYZ ( float  x,
float  y,
float  z 
)
inlinestatic

Converts XYZ representation to RGB.

Returns
Color resulting
Parameters
xX component
yY component
zZ component

◆ IsOpaque()

bool Nz::Color::IsOpaque ( ) const
inline

Return true is the color has no degree of transparency.

Returns
true if the color has an alpha value of 255

◆ operator!=()

bool Nz::Color::operator!= ( const Color color) const
inline

Checks whether the two colors are equal.

Returns
false if it is the case
Parameters
colorColor to compare

◆ operator*()

Color Nz::Color::operator* ( const Color color) const
inline

Multiplies two colors together.

Returns
Color which is the product
Parameters
colorOther color

TODO: Improve this shit

◆ operator*=()

Color Nz::Color::operator*= ( const Color color)
inline

Multiplies the color to this.

Returns
Color which is the product
Parameters
colorOther color

◆ operator+()

Color Nz::Color::operator+ ( const Color color) const
inline

Adds two colors together.

Returns
Color which is the sum
Parameters
colorOther color

TODO: Improve this shit

◆ operator+=()

Color Nz::Color::operator+= ( const Color color)
inline

Adds the color to this.

Returns
Color which is the sum
Parameters
colorOther color

◆ operator==()

bool Nz::Color::operator== ( const Color color) const
inline

Checks whether the two colors are equal.

Returns
true if it is the case
Parameters
colorColor to compare

◆ ToCMY()

void Nz::Color::ToCMY ( const Color color,
float *  cyan,
float *  magenta,
float *  yellow 
)
inlinestatic

Converts RGB representation to CMYK.

Parameters
colorColor to transform
cyanCyan component
magentaMagenta component
yellowYellow component

◆ ToCMYK()

void Nz::Color::ToCMYK ( const Color color,
float *  cyan,
float *  magenta,
float *  yellow,
float *  black 
)
inlinestatic

Converts RGB representation to CMYK.

Parameters
colorColor to transform
cyanCyan component
magentaMagenta component
yellowYellow component

◆ ToHSL()

void Nz::Color::ToHSL ( const Color color,
UInt8 *  hue,
UInt8 *  saturation,
UInt8 *  lightness 
)
inlinestatic

Converts RGB representation to HSL.

Parameters
colorColor to transform
hueHue component
saturationSaturation component
lightnessLightness component

◆ ToHSV()

void Nz::Color::ToHSV ( const Color color,
float *  hue,
float *  saturation,
float *  value 
)
inlinestatic

Converts RGB representation to HSV.

Parameters
colorColor to transform
hueHue component
saturationSaturation component
valueValue component

◆ ToString()

String Nz::Color::ToString ( ) const
inline

Converts this to string.

Returns
String representation of the object "Color(r, g, b[, a])"

◆ ToXYZ() [1/2]

void Nz::Color::ToXYZ ( const Color color,
Vector3f vec 
)
inlinestatic

Converts RGB representation to XYZ.

Parameters
colorColor to transform
vecVector3 representing the space color

◆ ToXYZ() [2/2]

void Nz::Color::ToXYZ ( const Color color,
float *  x,
float *  y,
float *  z 
)
inlinestatic

Converts RGB representation to XYZ.

Parameters
colorColor to transform
xX component
yY component
zZ component

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