Go to the documentation of this file.00001
00002 #include "CubitColor.hpp"
00003
00004
00005 CubitColor::CubitColor()
00006 : red(0), green(0), blue(0), alpha(0)
00007 {
00008 }
00009
00010 CubitColor::CubitColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
00011 : red(r), green(g), blue(b), alpha(a)
00012 {
00013 }
00014
00015 CubitColor::CubitColor(const CubitColor& other)
00016 : red(other.red), green(other.green), blue(other.blue), alpha(other.alpha)
00017 {
00018 }
00019
00020 bool CubitColor::operator==(const CubitColor& other) const
00021 {
00022 return red == other.red && green == other.green && blue == other.blue && alpha == other.alpha;
00023 }
00024
00025 bool CubitColor::operator!=(const CubitColor& other) const
00026 {
00027 return !operator==(other);
00028 }
00029
00031 CubitColor CubitColor::rgb_from_double(double r, double g, double b, double a)
00032 {
00033 return CubitColor(
00034 static_cast<unsigned char>(r*255.0),
00035 static_cast<unsigned char>(g*255.0),
00036 static_cast<unsigned char>(b*255.0),
00037 static_cast<unsigned char>(a*255.0)
00038 );
00039 }
00040