aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/colors/RGB.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'meowpp/colors/RGB.hpp')
-rw-r--r--meowpp/colors/RGB.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/meowpp/colors/RGB.hpp b/meowpp/colors/RGB.hpp
index b5786f4..f61b7fc 100644
--- a/meowpp/colors/RGB.hpp
+++ b/meowpp/colors/RGB.hpp
@@ -69,4 +69,15 @@ namespace meow{
inline int32_t RGBi::gMax() const { return 255; }
inline int32_t RGBi::bMin() const { return 0; }
inline int32_t RGBi::bMax() const { return 255; }
+
+
+ template<class RGB_T1, class RGB_T2>
+ inline void RGB_to_RGB(RGB<RGB_T1> const& a, RGB<RGB_T2>* b){
+ double r = normalize(a.rMin(), a.rMax(), a.r());
+ double g = normalize(a.gMin(), a.gMax(), a.g());
+ double x = normalize(a.bMin(), a.bMax(), a.b());
+ b->r(denormalize(b->rMin(), b->rMax(), r));
+ b->g(denormalize(b->gMin(), b->gMax(), g));
+ b->b(denormalize(b->bMin(), b->bMax(), x));
+ }
}