From 8476efbbba851d0a1cc5ceef4e7196ff5e786d36 Mon Sep 17 00:00:00 2001 From: Seth Fitzsimmons Date: Mon, 21 Jul 2014 18:08:43 -0700 Subject: [PATCH] Work in HSL so luma can be preserved Signed-off-by: artemp --- deps/agg/src/agg_pixfmt_rgba.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/deps/agg/src/agg_pixfmt_rgba.cpp b/deps/agg/src/agg_pixfmt_rgba.cpp index 4541e441b..dff0bdb90 100644 --- a/deps/agg/src/agg_pixfmt_rgba.cpp +++ b/deps/agg/src/agg_pixfmt_rgba.cpp @@ -1,6 +1,7 @@ #include "agg_pixfmt_rgba.h" #include #include +#include //#include namespace agg @@ -88,15 +89,16 @@ void comp_op_rgba_color::blend_pix(value_type* p, { using namespace boost; using namespace gil; - using namespace hsv_color_space; + using namespace hsl_color_space; rgb8_pixel_t rgb_src(sr,sg,sb); rgb8_pixel_t rgb_dst(p[Order::R],p[Order::G],p[Order::B]); - hsv32f_pixel_t hsv_src,hsv_dst; - color_convert( rgb_src, hsv_src); - color_convert( rgb_dst, hsv_dst); - get_color(hsv_dst,hue_t()) = get_color(hsv_src,hue_t()); - get_color(hsv_dst,saturation_t()) = get_color(hsv_src,saturation_t()); - color_convert(hsv_dst, rgb_dst); + hsl32f_pixel_t hsl_src,hsl_dst; + color_convert( rgb_src, hsl_src); + color_convert( rgb_dst, hsl_dst); + get_color(hsl_dst,hue_t()) = get_color(hsl_src,hue_t()); + get_color(hsl_dst,saturation_t()) = get_color(hsl_src,saturation_t()); + get_color(hsl_dst,lightness_t()) = get_color(hsl_dst,lightness_t()); + color_convert(hsl_dst, rgb_dst); p[Order::R] = get_color(rgb_dst,red_t()); p[Order::G] = get_color(rgb_dst,green_t()); p[Order::B] = get_color(rgb_dst,blue_t());