00001 00012 #include "Color.h" 00013 00014 #include <iostream> 00015 00016 using std::ostream; 00017 00018 Color Color:: red ( 255, 0, 0 ); 00019 Color Color:: green ( 0, 255, 0 ); 00020 Color Color:: blue ( 0, 0, 255 ); 00021 00022 Color Color:: cyan ( 0, 255, 255 ); 00023 Color Color::magenta ( 255, 0, 255 ); 00024 Color Color:: yellow ( 255, 255, 0 ); 00025 00026 Color Color:: orange ( 255, 165, 0 ); 00027 00028 Color Color:: black ( 0, 0, 0 ); 00029 Color Color:: darkgray ( 152, 152, 152 ); 00030 Color Color::lightgray ( 211, 211, 211 ); 00031 Color Color:: white ( 255, 255, 255 ); 00032 00033 Color::Color ( int red, int green, int blue ) 00034 : m_red( red ), m_green( green ), m_blue( blue ) 00035 { 00036 } 00037 00038 void Color::setColor ( int red, int green, int blue ) 00039 { 00040 m_red = red; 00041 m_green = green; 00042 m_blue = blue; 00043 } 00044 00045 int Color::getRed () const 00046 { 00047 return m_red; 00048 } 00049 int Color::getGreen () const 00050 { 00051 return m_green; 00052 } 00053 int Color::getBlue () const 00054 { 00055 return m_blue; 00056 } 00057 00058 ostream & operator << ( ostream & o, const Color & color ) 00059 { 00060 o << "RGB = {" 00061 << color.m_red << ", " 00062 << color.m_green << ", " 00063 << color.m_blue << "}"; 00064 return o; 00065 }