00001 /* 00002 ** PROJET 3ETI CPE Lyon 00003 ** Copyright (C) 2011 Damien Rohmer 00004 ** 00005 ** This program is free software: you can redistribute it and/or modify 00006 ** it under the terms of the GNU General Public License as published by 00007 ** the Free Software Foundation, either version 3 of the License, or 00008 ** (at your option) any later version. 00009 ** 00010 ** This program is distributed in the hope that it will be useful, 00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 ** GNU General Public License for more details. 00014 ** 00015 ** You should have received a copy of the GNU General Public License 00016 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef _COLOR_RGB_HPP_ 00020 #define _COLOR_RGB_HPP_ 00021 00022 #include <iostream> 00023 #include <exception_cpe.hpp> 00024 00025 namespace cpe 00026 { 00028 class color 00029 { 00030 public: 00031 00032 00033 // ********************************************* // 00034 // ********************************************* // 00035 // CONSTRUCTORS 00036 // ********************************************* // 00037 // ********************************************* // 00038 00040 color(); 00042 color(const unsigned char& r,const unsigned char& g,const unsigned char& b); 00043 00044 // ********************************************* // 00045 // ********************************************* // 00046 // ACCESS COLOR VALUE 00047 // ********************************************* // 00048 // ********************************************* // 00049 00051 const unsigned char& r() const; 00053 unsigned char& r(); 00054 00056 const unsigned char& g() const; 00058 unsigned char& g(); 00059 00061 const unsigned char& b() const; 00063 unsigned char& b(); 00064 00065 00066 // ********************************************* // 00067 // ********************************************* // 00068 // I/O 00069 // ********************************************* // 00070 // ********************************************* // 00071 00073 friend std::ostream& operator<<(std::ostream& stream,const color& c); 00074 00075 00076 private: 00077 00078 // ********************************************* // 00079 // ********************************************* // 00080 // INTERNAL STORAGE 00081 // ********************************************* // 00082 // ********************************************* // 00083 00085 unsigned char internal_r; 00087 unsigned char internal_g; 00089 unsigned char internal_b; 00090 00091 }; 00092 00093 00094 } 00095 00096 #endif