Color.hpp

00001 // This file is part of the imaging2 class library.
00002 //
00003 // University of Innsbruck, Infmath Imaging, 2009.
00004 // http://infmath.uibk.ac.at
00005 //
00006 // All rights reserved.
00007 
00008 
00009 #ifndef IMAGE_COLOR_H
00010 #define IMAGE_COLOR_H
00011 
00012 #include <core/imaging2.hpp>
00013 #include <image/Image.hpp>
00014 #include <image/GrayValue.hpp>
00015 
00016 namespace imaging
00017 {
00025   class Color : public ublas::fixed_vector<GrayValue, 3>
00026   {
00027   public:
00029     static const Color BLUE;
00030     
00032     static const Color RED;
00033     
00035     static const Color CYAN;
00036     
00038     static const Color GREEN;
00039     
00041     static const Color YELLOW;
00042     
00044     static const Color MAGENTA;
00045     
00047     static const Color BLACK;
00048     
00050     static const Color WHITE;
00051 
00052     Color() {}
00053     
00055     Color(const Color & color) : ublas::fixed_vector<GrayValue, 3>(color) {}
00056     
00058     Color(GrayValue value) { (*this)(0) = value; (*this)(1) = value; (*this)(2) = value; }
00059     
00061     Color(float_t value) { (*this)(0) = GrayValue(value); 
00062                             (*this)(1) = GrayValue(value);
00063                             (*this)(2) = GrayValue(value); }
00064                             
00066     Color(unsigned char r, unsigned char g, unsigned char b)
00067       : ublas::fixed_vector<GrayValue, 3>(GrayValue(r), GrayValue(g), GrayValue(b)) {}
00068       
00070     operator float_t() const { return float_t(GrayValue(*this)); }
00071   };
00072   
00082   typedef Image<2, Color> ColorImage2d;
00083   
00084   template<>
00085   void ColorImage2d::read_image(const std::string & file_name);
00086   
00087   template<>
00088   void ColorImage2d::write_image(const std::string & file_name) const;
00089   
00090 }
00091 
00092 #endif

Generated on Tue Feb 10 10:01:30 2009 for imaging2 by  doxygen 1.5.5