From bd25a9af92c7b988298597dea358d0d2d66123a5 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Thu, 24 May 2012 12:44:07 +0100 Subject: [PATCH] + handle boundary pixels in x/y gradients --- include/mapnik/image_filter.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/mapnik/image_filter.hpp b/include/mapnik/image_filter.hpp index 4045cabe8..6ff7b997b 100644 --- a/include/mapnik/image_filter.hpp +++ b/include/mapnik/image_filter.hpp @@ -409,7 +409,17 @@ void x_gradient_impl(Src const& src_view, Dst const& dst_view) { typename Src::x_iterator src_it = src_view.row_begin(y); typename Dst::x_iterator dst_it = dst_view.row_begin(y); - + + dst_it[0][0] = 127 + (src_it[0][0] - src_it[1][0]) / 2; + dst_it[0][1] = 127 + (src_it[0][1] - src_it[1][1]) / 2; + dst_it[0][2] = 127 + (src_it[0][2] - src_it[1][2]) / 2; + + dst_it[dst_view.width()-1][0] = 127 + (src_it[src_view.width()-2][0] - src_it[src_view.width()-1][0]) / 2; + dst_it[dst_view.width()-1][1] = 127 + (src_it[src_view.width()-2][1] - src_it[src_view.width()-1][1]) / 2; + dst_it[dst_view.width()-1][2] = 127 + (src_it[src_view.width()-2][2] - src_it[src_view.width()-1][2]) / 2; + + dst_it[0][3] = dst_it[src_view.width()-1][3] = 255; + for (int x=1; x