diff --git a/include/mapnik/graphics.hpp b/include/mapnik/graphics.hpp index 6faae9927..64a246d4a 100644 --- a/include/mapnik/graphics.hpp +++ b/include/mapnik/graphics.hpp @@ -117,47 +117,6 @@ public: return data_.height(); } - template - inline void merge_rectangle(image_data_rgba8 const& data, unsigned x0, unsigned y0, float opacity) - { - box2d ext0(0,0,data_.width(),data_.height()); - box2d ext1(x0,y0,x0 + data.width(),y0 + data.height()); - - if (ext0.intersects(ext1)) - { - box2d box = ext0.intersect(ext1); - for (int y = box.miny(); y < box.maxy(); ++y) - { - unsigned int* row_to = data_.getRow(y); - unsigned int const * row_from = data.getRow(y-y0); - for (int x = box.minx(); x < box.maxx(); ++x) - { - unsigned rgba0 = row_to[x]; - unsigned rgba1 = row_from[x-x0]; - unsigned a1 = int( ((rgba1 >> 24) & 0xff) * opacity ); - if (a1 == 0) continue; - unsigned r1 = rgba1 & 0xff; - unsigned g1 = (rgba1 >> 8 ) & 0xff; - unsigned b1 = (rgba1 >> 16) & 0xff; - - unsigned a0 = (rgba0 >> 24) & 0xff; - unsigned r0 = rgba0 & 0xff ; - unsigned g0 = (rgba0 >> 8 ) & 0xff; - unsigned b0 = (rgba0 >> 16) & 0xff; - - unsigned a = (a1 * 255 + (255 - a1) * a0 + 127)/255; - - MergeMethod::mergeRGB(r0,g0,b0,r1,g1,b1); - - r0 = (r1*a1 + (((255 - a1) * a0 + 127)/255) * r0 + 127)/a; - g0 = (g1*a1 + (((255 - a1) * a0 + 127)/255) * g0 + 127)/a; - b0 = (b1*a1 + (((255 - a1) * a0 + 127)/255) * b0 + 127)/a; - - row_to[x] = (a << 24)| (b0 << 16) | (g0 << 8) | (r0) ; - } - } - } - } }; }