00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef CVD_LA_H
00022 #define CVD_LA_H
00023
00024 #include <iostream>
00025 #include <cvd/internal/is_pod.h>
00026
00027 namespace CVD {
00028
00029
00031
00032
00033
00037 template <typename T>
00038 class La
00039 {
00040 public:
00042 La() {}
00046 La(T l, T a) : luminance(l), alpha(a) {}
00047
00048 T luminance;
00049 T alpha;
00050
00053 La<T>& operator=(const La<T>& c)
00054 {luminance = c.luminance; alpha = c.alpha; return *this;}
00055
00058 template <typename T2>
00059 La<T>& operator=(const La<T2>& c){
00060 luminance = static_cast<T>(c.luminance);
00061 alpha = static_cast<T>(c.alpha);
00062 return *this;
00063 }
00064
00067 bool operator==(const La<T>& c) const
00068 {return luminance == c.luminance && alpha == c.alpha;}
00069
00072 bool operator!=(const La<T>& c) const
00073 {return luminance != c.luminance || alpha != c.alpha;}
00074
00075 };
00076
00081 template <typename T>
00082 std::ostream& operator <<(std::ostream& os, const La<T>& x)
00083 {
00084 return os << "(" << x.luminance << "," << x.alpha << ")";
00085 }
00086
00091 inline std::ostream& operator <<(std::ostream& os, const La<unsigned char>& x)
00092 {
00093 return os << "(" << static_cast<unsigned int>(x.luminance) << ","
00094 << static_cast<unsigned int>(x.alpha) << ")";
00095 }
00096
00097 #ifndef DOXYGEN_IGNORE_INTERNAL
00098 namespace Internal
00099 {
00100 template<class C> struct is_POD<La<C> >
00101 {
00102 enum { is_pod = is_POD<C>::is_pod };
00103 };
00104 }
00105 #endif
00106
00107
00108
00109 }
00110 #endif
00111