Drag[en]gine Game Engine  1.0
decColor Class Reference

4 Component Color. More...

#include <decColor.h>

Public Member Functions

Constructors and Destructors
 decColor ()
 Create color initialized to (0,0,0,1). More...
 
 decColor (float red, float green, float blue)
 Create color with initial values. More...
 
 decColor (float red, float green, float blue, float alpha)
 Create color with the given values. More...
 
 decColor (const decColor &copy)
 Creates copy of a color. More...
 
 decColor (const decColor &copy, float alpha)
 Creates copy of a color with different alpha value. More...
 
Management
decColor Normalized () const
 Normalized color with each component clamped to the range of 0 to 1. More...
 
void Normalize ()
 Normalize color. Each component is clamped to the range of 0 to 1. More...
 
decColor Inverted () const
 Inverted color. Each component except alpha is 1-value. More...
 
void Invert ()
 Invert color. Each component except alpha is set to 1-value. More...
 
void SetZero ()
 Set red, green and blue to 0 and alpha to 1. More...
 
void Set (float red, float green, float blue)
 Set values. More...
 
void Set (float red, float green, float blue, float alpha)
 Sets values. More...
 
bool IsEqualTo (const decColor &color, float threshold=COLOR_THRESHOLD) const
 Color is equal component wise to another color with respect to a threshold. More...
 
Operators
decColoroperator= (const decColor &color)
 Copy color to this color. More...
 
decColoroperator+= (const decColor &color)
 Add components of another color to this one. More...
 
decColoroperator-= (const decColor &color)
 Subtract components of another color from this color. More...
 
decColoroperator*= (float scalar)
 Multiply components of this color with a value k. More...
 
decColoroperator/= (float scalar)
 Divide components of this color by a scalar value. More...
 
decColor operator+ (const decColor &color) const
 Color with the sum of this color with another one. More...
 
decColor operator- (const decColor &color) const
 Color with the difference of this color to another one. More...
 
decColor operator* (float scalar) const
 Color with this color scaled by a scalar. More...
 
decColor operator* (const decColor &color) const
 Color with this color multiplied component wise with another one. More...
 
decColor operator/ (float scalar) const
 Color with this color divided by a scalar. More...
 

Public Attributes

float a
 Alpha Component of color. More...
 
float b
 Blue Component of color. More...
 
float g
 Green Component of color. More...
 
float r
 Red Component of color. More...
 

Detailed Description

4 Component Color.

RGBA style color in decimal range. The value of 0 indicates no luminance in that color and 1 indicates full luminance. The color also contains an alpha component where 0 indicates completly transparent and 1 indicates completly opaque.

Author
Pl├╝ss Roland
Version
1.0
Date
2015

Constructor & Destructor Documentation

◆ decColor() [1/5]

decColor::decColor ( )

Create color initialized to (0,0,0,1).

◆ decColor() [2/5]

decColor::decColor ( float  red,
float  green,
float  blue 
)

Create color with initial values.

◆ decColor() [3/5]

decColor::decColor ( float  red,
float  green,
float  blue,
float  alpha 
)

Create color with the given values.

◆ decColor() [4/5]

decColor::decColor ( const decColor copy)

Creates copy of a color.

◆ decColor() [5/5]

decColor::decColor ( const decColor copy,
float  alpha 
)

Creates copy of a color with different alpha value.

Member Function Documentation

◆ Invert()

void decColor::Invert ( )

Invert color. Each component except alpha is set to 1-value.

◆ Inverted()

decColor decColor::Inverted ( ) const

Inverted color. Each component except alpha is 1-value.

◆ IsEqualTo()

bool decColor::IsEqualTo ( const decColor color,
float  threshold = COLOR_THRESHOLD 
) const

Color is equal component wise to another color with respect to a threshold.

◆ Normalize()

void decColor::Normalize ( )

Normalize color. Each component is clamped to the range of 0 to 1.

◆ Normalized()

decColor decColor::Normalized ( ) const

Normalized color with each component clamped to the range of 0 to 1.

◆ operator*() [1/2]

decColor decColor::operator* ( float  scalar) const

Color with this color scaled by a scalar.

◆ operator*() [2/2]

decColor decColor::operator* ( const decColor color) const

Color with this color multiplied component wise with another one.

◆ operator*=()

decColor& decColor::operator*= ( float  scalar)

Multiply components of this color with a value k.

◆ operator+()

decColor decColor::operator+ ( const decColor color) const

Color with the sum of this color with another one.

◆ operator+=()

decColor& decColor::operator+= ( const decColor color)

Add components of another color to this one.

◆ operator-()

decColor decColor::operator- ( const decColor color) const

Color with the difference of this color to another one.

◆ operator-=()

decColor& decColor::operator-= ( const decColor color)

Subtract components of another color from this color.

◆ operator/()

decColor decColor::operator/ ( float  scalar) const

Color with this color divided by a scalar.

Exceptions
deeDivisionByZeroScalar is 0.

◆ operator/=()

decColor& decColor::operator/= ( float  scalar)

Divide components of this color by a scalar value.

Exceptions
deeDivisionByZeroScalar is 0.

◆ operator=()

decColor& decColor::operator= ( const decColor color)

Copy color to this color.

◆ Set() [1/2]

void decColor::Set ( float  red,
float  green,
float  blue 
)

Set values.

◆ Set() [2/2]

void decColor::Set ( float  red,
float  green,
float  blue,
float  alpha 
)

Sets values.

◆ SetZero()

void decColor::SetZero ( )

Set red, green and blue to 0 and alpha to 1.

Member Data Documentation

◆ a

float decColor::a

Alpha Component of color.

◆ b

float decColor::b

Blue Component of color.

◆ g

float decColor::g

Green Component of color.

◆ r

float decColor::r

Red Component of color.


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