1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "CubitColor.hpp"


CubitColor::CubitColor()
  : red(0), green(0), blue(0), alpha(0)
{
}

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

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

bool CubitColor::operator==(const CubitColor& other) const
{
  return red == other.red && green == other.green && blue == other.blue && alpha == other.alpha;
}

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

//! create a CubitColor from double r,g,b. double value is between 0.0 and 1.0.
CubitColor CubitColor::rgb_from_double(double r, double g, double b, double a)
{<--- The function 'rgb_from_double' is never used.
  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)
      );
}