SilverLining::Color Class Reference

A RGBA color, where each component is represented as a float from 0-1. More...

#include <Color.h>

List of all members.

Public Member Functions

 Color ()
 Default constructor, initializes to black with no translucency.
 Color (float red, float green, float blue, float alpha)
 Constructor that takes in RGBA single-precision values that range from 0-1.
 Color (float red, float green, float blue)
 Constructor that takes in RGB single-precision values that range from 0-1.
 Color (double red, double green, double blue, double alpha)
 Constructor that takes in RGBA double-precision values that range from 0-1.
 Color (double red, double green, double blue)
 Constructor that takes in RGB double-precision values that range from 0-1.
 Color (int red, int green, int blue, int alpha)
 Constructor that takes in RGBA integer values that range from 0-1.
 Color (int red, int green, int blue)
 Constructor that takes in RGB integer values that range from 0-1.
Color operator* (float f) const
 Multiplication operator; multiplies each rgb component of the Color by a constant.
Color operator* (const Color &c) const
 Multiplication operator; multiplies two Colors together on a per-component basis.
Color operator+ (const Color &c) const
 Addition operator; adds two colors together on a per-component basis.
void ScaleToUnitOrLess ()
 If any component of the Color exceeds 1.0, every component will be scaled down uniformly such that the maximum color component equals 1.0.
void ClampToUnitOrLess ()
 Clamps each color component to be within the range [0, 1.0].
Color ToGrayscale () const
 Convert the RGB color to a grayscale value.
void Serialize (std::ostream &s) const
 Save this color to disk.
void Unserialize (std::istream &s)
 Restore this color from disk.

Detailed Description

A RGBA color, where each component is represented as a float from 0-1.


Constructor & Destructor Documentation

SilverLining::Color::Color (  )  [inline]

Default constructor, initializes to black with no translucency.

SilverLining::Color::Color ( float  red,
float  green,
float  blue,
float  alpha 
) [inline]

Constructor that takes in RGBA single-precision values that range from 0-1.

SilverLining::Color::Color ( float  red,
float  green,
float  blue 
) [inline]

Constructor that takes in RGB single-precision values that range from 0-1.

The alpha component is assumed to be 1.0.

SilverLining::Color::Color ( double  red,
double  green,
double  blue,
double  alpha 
) [inline]

Constructor that takes in RGBA double-precision values that range from 0-1.

SilverLining::Color::Color ( double  red,
double  green,
double  blue 
) [inline]

Constructor that takes in RGB double-precision values that range from 0-1.

The alpha component is assumed to be 1.0.

SilverLining::Color::Color ( int  red,
int  green,
int  blue,
int  alpha 
) [inline]

Constructor that takes in RGBA integer values that range from 0-1.

SilverLining::Color::Color ( int  red,
int  green,
int  blue 
) [inline]

Constructor that takes in RGB integer values that range from 0-1.

The alpha component is assumed to be 1.0.


Member Function Documentation

void SilverLining::Color::ClampToUnitOrLess (  )  [inline]

Clamps each color component to be within the range [0, 1.0].

Color SilverLining::Color::operator* ( const Color c  )  const [inline]

Multiplication operator; multiplies two Colors together on a per-component basis.

Color SilverLining::Color::operator* ( float  f  )  const [inline]

Multiplication operator; multiplies each rgb component of the Color by a constant.

Color SilverLining::Color::operator+ ( const Color c  )  const [inline]

Addition operator; adds two colors together on a per-component basis.

void SilverLining::Color::ScaleToUnitOrLess (  )  [inline]

If any component of the Color exceeds 1.0, every component will be scaled down uniformly such that the maximum color component equals 1.0.

void SilverLining::Color::Serialize ( std::ostream &  s  )  const [inline]

Save this color to disk.

Color SilverLining::Color::ToGrayscale (  )  const [inline]

Convert the RGB color to a grayscale value.

void SilverLining::Color::Unserialize ( std::istream &  s  )  [inline]

Restore this color from disk.


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

Generated by  doxygen 1.6.2