Created
June 17, 2012 19:25
-
-
Save springmeyer/2945498 to your computer and use it in GitHub Desktop.
color spin in mapnik/agg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/deps/agg/build.py b/deps/agg/build.py | |
index 9e2db94..6ba8228 100644 | |
--- a/deps/agg/build.py | |
+++ b/deps/agg/build.py | |
@@ -24,8 +24,8 @@ Import('env') | |
agg_env = env.Clone() | |
if env['SUNCC']: | |
- cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O -KPIC -DNDEBUG' | |
+ cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O -KPIC -DNDEBUG ' | |
else: | |
cxxflags = env['CUSTOM_CXXFLAGS'] + ' -O%s -fPIC -DNDEBUG' % env['OPTIMIZATION'] | |
-agg_env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CPPPATH='./include', CXXFLAGS=cxxflags, LINKFLAGS=env['CUSTOM_LDFLAGS']) | |
\ No newline at end of file | |
+agg_env.StaticLibrary('agg', glob.glob('./src/' + '*.cpp'), LIBS=[], CXXFLAGS=cxxflags, LINKFLAGS=env['CUSTOM_LDFLAGS']) | |
\ No newline at end of file | |
diff --git a/deps/agg/include/agg_pixfmt_rgba.h b/deps/agg/include/agg_pixfmt_rgba.h | |
index 7d2ef4f..dec0628 100644 | |
--- a/deps/agg/include/agg_pixfmt_rgba.h | |
+++ b/deps/agg/include/agg_pixfmt_rgba.h | |
@@ -30,6 +30,7 @@ | |
#include "agg_basics.h" | |
#include "agg_color_rgba.h" | |
#include "agg_rendering_buffer.h" | |
+#include <boost/gil/gil_all.hpp> | |
namespace agg | |
{ | |
@@ -1385,6 +1386,33 @@ namespace agg | |
}; | |
+ // color spin (new) | |
+ // E = I + M - 128 | |
+ | |
+ template <typename ColorT, typename Order> | |
+ struct comp_op_rgba_color_spin | |
+ { | |
+ typedef ColorT color_type; | |
+ typedef Order order_type; | |
+ typedef typename color_type::value_type value_type; | |
+ typedef typename color_type::calc_type calc_type; | |
+ typedef typename color_type::long_type long_type; | |
+ enum base_scale_e | |
+ { | |
+ base_shift = color_type::base_shift, | |
+ base_mask = color_type::base_mask | |
+ }; | |
+ | |
+ // Dca' = (Da - Dca) * Sca + Dca.(1 - Sa) | |
+ // Da' = Sa + Da - Sa.Da | |
+ static AGG_INLINE void blend_pix(value_type* p, | |
+ // source rgb | |
+ unsigned sr, unsigned sg, unsigned sb, | |
+ // source alpha and opacity | |
+ unsigned sa, unsigned cover); | |
+ }; | |
+ | |
+ | |
// merge grain (GIMP) | |
// E = I + M - 128 | |
@@ -1520,6 +1548,7 @@ namespace agg | |
comp_op_rgba_invert_rgb <ColorT,Order>::blend_pix, | |
comp_op_rgba_grain_merge<ColorT,Order>::blend_pix, | |
comp_op_rgba_grain_extract<ColorT,Order>::blend_pix, | |
+ comp_op_rgba_color_spin<ColorT,Order>::blend_pix, | |
0 | |
}; | |
@@ -1557,6 +1586,7 @@ namespace agg | |
comp_op_invert_rgb, //----comp_op_invert_rgb | |
comp_op_grain_merge, //----comp_op_grain_merge_rgb | |
comp_op_grain_extract, //----comp_op_grain_extract_rgb | |
+ comp_op_color_spin, //----comp_op_color_spin | |
end_of_comp_op_e | |
}; | |
diff --git a/deps/agg/src/agg_pixfmt_rgba.cpp b/deps/agg/src/agg_pixfmt_rgba.cpp | |
new file mode 100644 | |
index 0000000..734d58e | |
--- /dev/null | |
+++ b/deps/agg/src/agg_pixfmt_rgba.cpp | |
@@ -0,0 +1,17 @@ | |
+#include "agg_pixfmt_rgba.h" | |
+#include <iostream> | |
+ | |
+namespace agg | |
+{ | |
+ template<class ColorT, class Order> | |
+ void comp_op_rgba_color_spin<ColorT,Order>::blend_pix(value_type* p, | |
+ unsigned sr, unsigned sg, unsigned sb, | |
+ unsigned sa, unsigned cover) | |
+ { | |
+ p[Order::R] = (value_type)(50 >> base_shift); | |
+ p[Order::G] = (value_type)(150 >> base_shift); | |
+ p[Order::B] = (value_type)(50 >> base_shift); | |
+ std::clog << "running\n"; | |
+ } | |
+ template struct comp_op_rgba_color_spin<agg::rgba8, agg::order_rgba>; | |
+} | |
\ No newline at end of file | |
diff --git a/include/mapnik/image_compositing.hpp b/include/mapnik/image_compositing.hpp | |
index 09c9e0d..b2a8cb4 100644 | |
--- a/include/mapnik/image_compositing.hpp | |
+++ b/include/mapnik/image_compositing.hpp | |
@@ -70,6 +70,7 @@ enum composite_mode_e | |
invert, | |
invert_rgb, | |
grain_merge, | |
+ color_spin, | |
grain_extract | |
}; | |
diff --git a/src/image_compositing.cpp b/src/image_compositing.cpp | |
index fb2fc61..e4f6039 100644 | |
--- a/src/image_compositing.cpp | |
+++ b/src/image_compositing.cpp | |
@@ -69,6 +69,7 @@ static const comp_op_lookup_type comp_lookup = boost::assign::list_of<comp_op_lo | |
(invert,"invert") | |
(invert_rgb,"invert-rgb") | |
(grain_merge,"grain-merge") | |
+ (color_spin,"color-spin") | |
(grain_extract,"grain-extract") | |
; | |
diff --git a/src/parse_transform.cpp b/src/parse_transform.cpp | |
index 325d440..4e53d08 100644 | |
--- a/src/parse_transform.cpp | |
+++ b/src/parse_transform.cpp | |
@@ -55,8 +55,8 @@ bool parse_transform(transform_list& transform, | |
bool r = qi::phrase_parse(itr, end, g, space_type(), transform); | |
#ifdef MAPNIK_LOG | |
- MAPNIK_LOG_DEBUG(load_map) << "map_parser: Parsed transform [ " | |
- << transform_processor_type::to_string(transform) << " ]"; | |
+ // MAPNIK_LOG_DEBUG(load_map) << "map_parser: Parsed transform [ " | |
+ // << transform_processor_type::to_string(transform) << " ]"; | |
#endif | |
return (r && itr==end); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment