ISIS Core Library 0.7.2 (api 3.0.0)
|
00001 #ifndef COLOR_HPP_INCLUDED 00002 #define COLOR_HPP_INCLUDED 00003 00004 #include <ostream> 00005 #include "common.hpp" 00006 00007 namespace isis 00008 { 00009 namespace util 00010 { 00011 00013 template<typename T> struct color { 00014 T r, g, b; 00015 template<typename O> bool operator==( const color<O> &other )const { 00016 return r == other.r && g == other.g && b == other.b; 00017 } 00018 template<typename O> bool operator!=( const color<O> &other )const { 00019 return ! operator==( other ); 00020 } 00021 }; 00022 00023 typedef color<uint8_t> color24; 00024 typedef color<uint16_t> color48; 00025 } 00026 } 00027 00028 namespace std 00029 { 00031 template<typename charT, typename traits, typename T> 00032 basic_ostream<charT, traits>& operator<<( basic_ostream<charT, traits> &out, const isis::util::color<T>& s ) 00033 { 00034 const T *const begin = &s.r; 00035 isis::util::listToOStream( begin, begin + 3, out ); 00036 return out; 00037 } 00038 } 00039 #endif //COLOR_HPP_INCLUDED