Overview   Project   Class   Tree   Deprecated   Index 
CarnegieMellonGraphics
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

CarnegieMellonGraphics2
Class Color

   in CarnegieMellonGraphics.h

class Color

The Color class is used by the system to represent color information (of all things). The default color object is simply black, but it is also possible to construct a color by specifying RGB (red, green, blue) and RGBA (red, green, blue, alpha) component values. The alpha channel information is use to carry information about the opacity of the color. It is possible that your renderer may not support this capability, in which case it is simply ignored.

Currently, the internal representation of colors is unsigned characters, and the external representation uses integers. This is not completely satisfactory, because the user can create colors using invalid components. Currently, component values are clamped between 0 and 255 and issues a warning message when an out of bounds color is supplied. In future releases it may be desirable to use an internal and external representation that will more closely match. The internal representation can be changed to use integers, but then the end user would have to use negative numbers to specify some values, which is not entirely intutitive. Floating point values have the same sort of problem.


Field Summary
 static const Color BLACK
          
 static const Color BLUE
          
 static const Color GREEN
          
 static const Color RED
          
 static const Color WHITE
          
 
Constructor Summary
Color()
          Construct an empty color (which is by default, fully opaque black)
Color( int red, int green, int blue )
          Construct a completely opaque color from three component hues
Color( int red, int green, int blue, int alpha )
          Construct a color from the three component hues and an alpha channel.
 
Method Summary
 int getAlpha() const
          
 int getBlue() const
          
 int getGreen() const
          
 int getRed() const
          
 bool operator!=( const Color& rhs ) const
          Comparison operator for inequality on color objects
 bool operator==( const Color& rhs ) const
          Comparison operator for equality on color objects
 void setAlpha( int value )
          
 void setBlue( int value )
          
 void setGreen( int value )
          
 void setRed( int value )
          
 

Field Detail

BLACK

public static const Color BLACK;

BLUE

public static const Color BLUE;

GREEN

public static const Color GREEN;

RED

public static const Color RED;

WHITE

public static const Color WHITE;


Constructor Detail

Color

public Color();
Construct an empty color (which is by default, fully opaque black)

Color

public Color( int red, int green, int blue );
Construct a completely opaque color from three component hues

Color

public Color( int red, int green, int blue, int alpha );
Construct a color from the three component hues and an alpha channel. This may be used to provide opacity information to the renderer.


Method Detail

getAlpha

public int getAlpha() const;

getBlue

public int getBlue() const;

getGreen

public int getGreen() const;

getRed

public int getRed() const;

operator!=

public bool operator!=( const Color& rhs ) const;
Comparison operator for inequality on color objects

operator==

public bool operator==( const Color& rhs ) const;
Comparison operator for equality on color objects

setAlpha

public void setAlpha( int value );

setBlue

public void setBlue( int value );

setGreen

public void setGreen( int value );

setRed

public void setRed( int value );

 Overview   Project   Class   Tree   Deprecated   Index 
CarnegieMellonGraphics
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD