cgma
CubitColor Struct Reference

#include <CubitColor.hpp>

List of all members.

Public Member Functions

 CubitColor ()
 CubitColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 CubitColor (const CubitColor &other)
bool operator== (const CubitColor &other) const
bool operator!= (const CubitColor &other) const

Static Public Member Functions

static CubitColor rgb_from_double (double r, double g, double b, double a=1.0)
 create a CubitColor from double r,g,b. double value is between 0.0 and 1.0.

Public Attributes

unsigned char red
unsigned char green
unsigned char blue
unsigned char alpha

Detailed Description

CubitColor class to represent RGBA colors. Values are unsigned chars with a range of 0 to 255.

Definition at line 8 of file CubitColor.hpp.


Constructor & Destructor Documentation

Definition at line 5 of file CubitColor.cpp.

  : red(0), green(0), blue(0), alpha(0)
{
}
CubitColor::CubitColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Definition at line 10 of file CubitColor.cpp.

  : red(r), green(g), blue(b), alpha(a)
{
}
CubitColor::CubitColor ( const CubitColor other)

Definition at line 15 of file CubitColor.cpp.

  : red(other.red), green(other.green), blue(other.blue), alpha(other.alpha)
{
}

Member Function Documentation

bool CubitColor::operator!= ( const CubitColor other) const

Definition at line 25 of file CubitColor.cpp.

{
  return !operator==(other);
}
bool CubitColor::operator== ( const CubitColor other) const

Definition at line 20 of file CubitColor.cpp.

{
  return red == other.red && green == other.green && blue == other.blue && alpha == other.alpha;
}
CubitColor CubitColor::rgb_from_double ( double  r,
double  g,
double  b,
double  a = 1.0 
) [static]

create a CubitColor from double r,g,b. double value is between 0.0 and 1.0.

Definition at line 31 of file CubitColor.cpp.

{
  return CubitColor(
      static_cast<unsigned char>(r*255.0),
      static_cast<unsigned char>(g*255.0),
      static_cast<unsigned char>(b*255.0),
      static_cast<unsigned char>(a*255.0)
      );
}

Member Data Documentation

unsigned char CubitColor::alpha

Definition at line 24 of file CubitColor.hpp.

unsigned char CubitColor::blue

Definition at line 23 of file CubitColor.hpp.

unsigned char CubitColor::green

Definition at line 22 of file CubitColor.hpp.

unsigned char CubitColor::red

Definition at line 21 of file CubitColor.hpp.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines