Permalink
Browse files

+ add premultiplied_alpha flag to mapnik::raster

  • Loading branch information...
1 parent 77e5858 commit 3ffe8ec21cd98f15fba3fb1a66f3a648c3daf52c @artemp artemp committed Sep 28, 2012
@@ -32,11 +32,13 @@ struct raster
{
box2d<double> ext_;
image_data_32 data_;
- raster(box2d<double> const& ext,image_data_32 const& data)
+ bool premultiplied_alpha_;
+ raster(box2d<double> const& ext,image_data_32 const& data, bool premultiplied_alpha = false)
: ext_(ext),
- data_(data) {}
+ data_(data),
+ premultiplied_alpha_(premultiplied_alpha)
+ {}
};
}
#endif // MAPNIK_RASTER_HPP
-
@@ -113,7 +113,7 @@ feature_ptr raster_featureset<LookupPolicy>::next()
image_data_32 image(width,height);
reader->read(x_off, y_off, image);
- feature->set_raster(boost::make_shared<raster>(intersect, image));
+ feature->set_raster(boost::make_shared<raster>(intersect, image,reader->premultiplied_alpha()));
}
}
}
@@ -96,7 +96,9 @@ void agg_renderer<T>::process(raster_symbolizer const& sym,
filter_radius);
}
}
- composite(current_buffer_->data(), target.data_, sym.comp_op(), sym.get_opacity(), start_x, start_y, true);
+ composite(current_buffer_->data(), target.data_,
+ sym.comp_op(), sym.get_opacity(),
+ start_x, start_y, !source->premultiplied_alpha_);
}
}
}

0 comments on commit 3ffe8ec

Please sign in to comment.