Color Class Reference

#include <Color.hpp>

List of all members.


Detailed Description

This class defines a color.

The color can be defined using a variety of constructors.

Examples:

example13.cpp.

Definition at line 44 of file Color.hpp.

Public Member Functions

 Color (void)
 Color default is black.
 Color (int rgbDef)
 Color initialized using a single value in three bytes, 0xRRGGBB.
 Color (int red, int green, int blue)
 Color initialized using 3 integers describing (from 0-255) the red, green, and blue components of the color.
 Color (const std::string &colorName)
 Color initialized using a single string.
bool operator== (const Color &rhs) const
 Operator ==.
bool operator!= (const Color &rhs) const
 Operator !=.
void setToString (const std::string &str)
 Uses a string to set the value of the color.
int getRGB (void) const
 Returns a int that can be manipulated to display the hex equivalent of a color.
void getRGBTriplet (short &red, short &green, short &blue) const
 Sets input shorts to their appropriate color value (0-255).
void getRGBTripletFractional (double &red, double &green, double &blue) const
 Sets input doubles to their appropriate color value (0-1).
void setRGBTriplet (short red, short green, short blue)
 Sets the color to the appropriate color value given by input variables.
void setRGBTripletFractional (double red, double green, double blue)
 Sets the color to the appropriate color value given by input variables.
int dist (const Color &o) const
 Get the distance between the two Colors.
Color interpolate (double dist, const Color &o) const
 Interpolate between two colors.
bool isClear (void) const
 Used to determine if this color is clear.

Static Public Attributes

const int RED = 0xFF0000
 FF0000
const int ORANGE = 0xFFA500
 FFA500
const int YELLOW = 0xFFFF00
 FFFF00
const int GREEN = 0x00FF00
 00FF00
const int BLUE = 0x0000FF
 0000FF
const int VIOLET = 0xEE82EE
 EE82EE
const int WHITE = 0xFFFFFF
 FFFFFF
const int BROWN = 0xA5252A
 A5252A
const int BLACK = 0x000000
 000000
const int GREY = 0xBEBEBE
 BEBEBE
const int GRAY = 0xBEBEBE
 BEBEBE
const int PINK = 0xFFC0CB
 FFC0CB
const int CYAN = 0x00FFFF
 00FFFF
const int OLIVE = 0x6B8E23
 6BBE23
const int KHAKI = 0xBDB76B
 BDB76B
const int SKY_BLUE = 0x87CEEB
 87CEEB
const int TURQUOISE = 0x40E0D0
 40E0D0
const int CHARTREUSE = 0x7FFF00
 7FFF00
const int MAGENTA = 0xFF00FF
 FF00FF
const int MAROON = 0xB03060
 B03060
const int BURNT_ORANGE = 0xCD5500
 CD5500
const int CARDINAL = 0x9C0001
 9C0001
const int NAVY = 0x000080
 000080
const int FOREST_GREEN = 0x228B22
 228B22
const int DARK_PURPLE = 0x800080
 800080
const int CLEAR = -1
 This constant can be used to declare something as "invisible." Its primary use is for creating a type of line that shall only be displayed as points using a marker.

Protected Attributes

int rgb
 Color as an RGB value.


Constructor & Destructor Documentation

Color void   )  [inline]
 

Color default is black.

Definition at line 116 of file Color.hpp.

Color int  rgbDef  )  [inline]
 

Color initialized using a single value in three bytes, 0xRRGGBB.

The first byte is red, the next is green, the last is blue. For example, 0x00FF00 is pure green.

Definition at line 123 of file Color.hpp.

Color int  red,
int  green,
int  blue
[inline]
 

Color initialized using 3 integers describing (from 0-255) the red, green, and blue components of the color.

Definition at line 134 of file Color.hpp.

Color const std::string &  colorName  )  [inline]
 

Color initialized using a single string.

See also:
Color::setToString for a list of valid strings.
Parameters:
colorName String description of what this color should end up as.

Definition at line 151 of file Color.hpp.


Member Function Documentation

int dist const Color o  )  const [inline]
 

Get the distance between the two Colors.

Definition at line 230 of file Color.hpp.

References gpstk::abs(), and getRGBTriplet().

int getRGB void   )  const [inline]
 

Returns a int that can be manipulated to display the hex equivalent of a color.

Returns:
A int containing the 0xRRGGBB equivalent of the color.

Definition at line 192 of file Color.hpp.

Referenced by PSImageBase::bitmap(), PNG::ctos(), SVGImage::text(), and Marker::uniqueName().

void getRGBTriplet short &  red,
short &  green,
short &  blue
const
 

Sets input shorts to their appropriate color value (0-255).

Parameters:
[out] red short to contain the red color value
[out] green short to contain the green color value
[out] blue short to contain the blue color value

Referenced by dist().

void getRGBTripletFractional double &  red,
double &  green,
double &  blue
const
 

Sets input doubles to their appropriate color value (0-1).

Where 1 is equivalent to 255 or the max amount of that color.

Parameters:
[out] red double to contain the red color value
[out] green double to contain the green color value
[out] blue double to contain the blue color value

Referenced by PSImageBase::line(), and PSImageBase::text().

Color interpolate double  dist,
const Color o
const
 

Interpolate between two colors.

bool isClear void   )  const [inline]
 

Used to determine if this color is clear.

Returns:
A boolean denoting that this color is clear(true) or not clear(false).

Definition at line 247 of file Color.hpp.

Referenced by SeriesList::drawInFrame().

bool operator!= const Color rhs  )  const [inline]
 

Operator !=.

Definition at line 157 of file Color.hpp.

References rgb.

bool operator== const Color rhs  )  const [inline]
 

Operator ==.

Definition at line 154 of file Color.hpp.

References rgb.

void setRGBTriplet short  red,
short  green,
short  blue
 

Sets the color to the appropriate color value given by input variables.

Parameters:
red short containing the red color value (0-255)
green short containing the green color value (0-255)
blue short containing the blue color value (0-255)

void setRGBTripletFractional double  red,
double  green,
double  blue
 

Sets the color to the appropriate color value given by input variables.

Parameters:
red short containing the red color value (0-1)
green short containing the green color value (0-1)
blue short containing the blue color value (0-1)

void setToString const std::string &  str  ) 
 

Uses a string to set the value of the color.

Here are the values

  • "red" or "r"
  • "orange" or "o"
  • "yellow" or "y"
  • "green" or "g"
  • "blue" or "b"
  • "violet" or "v"
  • "white" or "w"
  • "brown" or "k"
  • "black" or "n"
  • "grey" or "gray"
  • "forest green" or "forest"
  • "pink"
  • "cyan"
  • "olive"
  • "khaki"
  • "sky blue"
  • "turquoise"
  • "magenta"
  • "maroon"
  • "burnt orange"
  • "cardinal"
  • "clear"
  • "navy"
  • "dark purple"


Member Data Documentation

const int CLEAR = -1 [static]
 

This constant can be used to declare something as "invisible." Its primary use is for creating a type of line that shall only be displayed as points using a marker.

Thus these points are each separated, not connected by a line.

Definition at line 111 of file Color.hpp.

int rgb [protected]
 

Color as an RGB value.

Definition at line 252 of file Color.hpp.

Referenced by operator!=(), and operator==().


The documentation for this class was generated from the following file:
Generated on Thu May 23 03:31:35 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1