- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ufo::UColor Class Reference

An abstraction of a four float array (red, green, blue and alpha) describing a color. More...

#include <ucolor.hpp>

Inheritance diagram for ufo::UColor:

ufo::UColorObject List of all members.

Public Member Functions

 UColor ()
 UColor (const UColor &col)
 UColor (const std::string &colorString)
 UColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 UColor (const uint8_t rgba[], bool hasAlpha=false)
 UColor (int r, int g, int b, int a=255)
 UColor (const int rgba[], bool hasAlpha=false)
 UColor (float r, float g, float b, float a=1.0f)
 UColor (const float rgba[], bool hasAlpha=false)
 UColor (double r, double g, double b, double a=1.0)
 UColor (const double rgba[], bool hasAlpha=false)
const float * getFloat () const
float * getFloat ()
float getRed () const
float getGreen () const
float getBlue () const
float getAlpha () const
uint32_t getArgb () const
uint32_t getRgba () const
UColor darker () const
UColor brighter () const
bool isBlack () const
bool isWhite () const

Static Public Attributes

const UColor red
const UColor green
const UColor blue
const UColor darkRed
const UColor darkGreen
const UColor darkBlue
const UColor white
const UColor black
const UColor gray
const UColor darkGray
const UColor lightGray
const UColor cyan
const UColor magenta
const UColor yellow
const UColor darkCyan
const UColor darkMagenta
const UColor darkYellow

Friends

bool operator== (const UColor &col1, const UColor &col2)
bool operator!= (const UColor &col1, const UColor &col2)
std::ostream & operator<< (std::ostream &os, const UColor &col)

Detailed Description

An abstraction of a four float array (red, green, blue and alpha) describing a color.

This class is not part of the UObject inheritance structure. Use instead UColorObject if you need a color derived from UObject.

Author:
Johannes Schmidt


Constructor & Destructor Documentation

ufo::UColor::UColor  ) 
 

Creates a black color.

ufo::UColor::UColor const std::string &  colorString  )  [explicit]
 

Creates a color decoding the given string. You can either use a hex string if prefixed with '#' or a comma or blank space separated list of integer values.

Valid strings are (all white): "#ffffffff", "#0xffffffff", "255,255,255,255", "255, 255, 255, 255", "255 255 255 255"

Parameters:
colorString A character string in one of the above representations


Member Function Documentation

UColor ufo::UColor::brighter  )  const
 

returns a darker version of the color. The Alpha value is untouched. Multiplies each rgb value with 1 / FACTOR.

UColor ufo::UColor::darker  )  const
 

returns a darker version of the color. The Alpha value is untouched. Multiplies each rgb value with FACTOR.

float * ufo::UColor::getFloat  )  [inline]
 

The returned data is in system memory and should not be deleted.

Returns:
the color values as float array

const float * ufo::UColor::getFloat  )  const [inline]
 

The returned data is in system memory and should not be deleted.

Returns:
the color values as float array

bool ufo::UColor::isBlack  )  const [inline]
 

Returns:
True if all color components are exactly 0.

bool ufo::UColor::isWhite  )  const [inline]
 

Returns:
True if all color components are exactly 1.0f.


The documentation for this class was generated from the following file:
The libUFO Project - written by Johannes Schmidt