diff options
Diffstat (limited to 'meowpp/colors/RGB.h')
-rw-r--r-- | meowpp/colors/RGB.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/meowpp/colors/RGB.h b/meowpp/colors/RGB.h new file mode 100644 index 0000000..04b52a1 --- /dev/null +++ b/meowpp/colors/RGB.h @@ -0,0 +1,66 @@ +#ifndef RGB_H_ +#define RGB_H_ + +namespace meow{ + template<class T> + class RGB{ + protected: + T rgb_[3]; + RGB(); + RGB(T const& r, T const& g, T const& b); + RGB(T const* rgb); + public: + virtual ~RGB() { } + ///////////////// **# not force #** //////////////// + virtual T rMax() const = 0; + virtual T rMin() const = 0; + virtual T gMax() const = 0; + virtual T gMin() const = 0; + virtual T bMax() const = 0; + virtual T bMin() const = 0; + /////////////////// **# access #** ///////////////// + T r() const; + T g() const; + T b() const; + T rgb(size_t i) const; + T bgr(size_t i) const; + /////////////////// **# setting #** //////////////// + T r(T const& val); + T g(T const& val); + T b(T const& val); + T rgb(size_t i, T const& val); + T bgr(size_t i, T const& val); + }; + + class RGBf: public RGB<double>{ + public: + RGBf(); + RGBf(double const&r,double const&g,double const&b); + RGBf(double const* rgb); + ~RGBf(); + double rMin() const; + double rMax() const; + double gMin() const; + double gMax() const; + double bMin() const; + double bMax() const; + }; + + class RGBi: public RGB<int32_t>{ + public: + RGBi(); + RGBi(int32_t const&r,int32_t const&g,int32_t const&b); + RGBi(int32_t const* rgb); + ~RGBi(); + int32_t rMin() const; + int32_t rMax() const; + int32_t gMin() const; + int32_t gMax() const; + int32_t bMin() const; + int32_t bMax() const; + }; +} + +#include "RGB.hpp" + +#endif // RGB_H_ |