SilverLining::Color Class Reference

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

#include <Color.h>

Inherits SilverLining::MemObject.

Collaboration diagram for SilverLining::Color:
Collaboration graph
[legend]

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 SILVERLINING_API operator* (float f) const
 Multiplication operator; multiplies each rgb component of the Color by a constant.
Color SILVERLINING_API operator* (const Color &c) const
 Multiplication operator; multiplies two Colors together on a per-component basis.
Color SILVERLINING_API operator+ (const Color &c) const
 Addition operator; adds two colors together on a per-component basis.
bool SILVERLINING_API operator== (const Color &c) const
 Equality operator.
bool SILVERLINING_API operator!= (const Color &c) const
 Inequality operator.
void SILVERLINING_API 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 SILVERLINING_API ClampToUnitOrLess ()
 Clamps each color component to be within the range [0, 1.0].
Color SILVERLINING_API ToGrayscale () const
 Convert the RGB color to a grayscale value.
void SILVERLINING_API Serialize (std::ostream &s) const
 Save this color to disk.
void SILVERLINING_API 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_API SilverLining::Color::ClampToUnitOrLess (  )  [inline]

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

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

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

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

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

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

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

void SILVERLINING_API 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_API SilverLining::Color::Serialize ( std::ostream &  s  )  const [inline]

Save this color to disk.

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

Convert the RGB color to a grayscale value.

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

Restore this color from disk.


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

Generated on 22 Mar 2012 for SilverLining by  doxygen 1.6.1