Merge branch 'master' of github.com:mapnik/mapnik
This commit is contained in:
commit
fb0ef869d6
9 changed files with 56 additions and 41 deletions
6
deps/agg/include/agg_basics.h
vendored
6
deps/agg/include/agg_basics.h
vendored
|
@ -35,8 +35,10 @@ namespace agg
|
|||
//------------------------------------------------------------pod_allocator
|
||||
template<class T> struct pod_allocator
|
||||
{
|
||||
static T* allocate(unsigned num) { return static_cast<T*>(::operator new(sizeof(T)*num));}
|
||||
static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;}
|
||||
//static T* allocate(unsigned num) { return static_cast<T*>(::operator new(sizeof(T)*num));}
|
||||
//static void deallocate(T* ptr, unsigned) { ::operator delete(ptr) ;}
|
||||
static T* allocate(unsigned num) { return new T [num]; }
|
||||
static void deallocate(T* ptr, unsigned) { delete [] ptr; }
|
||||
};
|
||||
|
||||
// Single object allocator. It's also can be replaced with your custom
|
||||
|
|
|
@ -70,8 +70,9 @@ public:
|
|||
|
||||
void start_style_processing(feature_type_style const& st);
|
||||
void end_style_processing(feature_type_style const& st);
|
||||
|
||||
void render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity);
|
||||
|
||||
void render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr,
|
||||
double opacity, composite_mode_e comp_op);
|
||||
|
||||
void process(point_symbolizer const& sym,
|
||||
mapnik::feature_ptr const& feature,
|
||||
|
@ -103,7 +104,7 @@ public:
|
|||
void process(markers_symbolizer const& sym,
|
||||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans);
|
||||
|
||||
|
||||
inline bool process(rule::symbolizers const& /*syms*/,
|
||||
mapnik::feature_ptr const& /*feature*/,
|
||||
proj_transform const& /*prj_trans*/)
|
||||
|
@ -111,9 +112,9 @@ public:
|
|||
// agg renderer doesn't support processing of multiple symbolizers.
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
void painted(bool painted);
|
||||
|
||||
|
||||
private:
|
||||
buffer_type & pixmap_;
|
||||
boost::shared_ptr<buffer_type> internal_buffer_;
|
||||
|
|
|
@ -77,15 +77,15 @@ class MAPNIK_DECL gradient
|
|||
// transform
|
||||
agg::trans_affine transform_;
|
||||
public:
|
||||
explicit gradient();
|
||||
gradient();
|
||||
gradient(gradient const& other);
|
||||
gradient& operator=(const gradient& rhs);
|
||||
|
||||
void set_gradient_type(gradient_e grad);
|
||||
gradient_e get_gradient_type() const;
|
||||
|
||||
void set_transform(agg::trans_affine transform);
|
||||
agg::trans_affine get_transform() const;
|
||||
void set_transform(agg::trans_affine const& transform);
|
||||
agg::trans_affine const& get_transform() const;
|
||||
|
||||
void set_units(gradient_unit_e units);
|
||||
gradient_unit_e get_units() const;
|
||||
|
|
|
@ -248,21 +248,27 @@ void agg_renderer<T>::end_style_processing(feature_type_style const& st)
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity)
|
||||
void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& marker, agg::trans_affine const& tr,
|
||||
double opacity, composite_mode_e comp_op)
|
||||
{
|
||||
if (marker.is_vector())
|
||||
{
|
||||
typedef agg::pixfmt_rgba32 pixfmt;
|
||||
typedef agg::renderer_base<pixfmt> renderer_base;
|
||||
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgba order_type;
|
||||
typedef agg::pixel32_type pixel_type;
|
||||
typedef agg::comp_op_adaptor_rgba<color_type, order_type> blender_type; // comp blender
|
||||
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_comp_type;
|
||||
typedef agg::renderer_base<pixfmt_comp_type> renderer_base;
|
||||
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_type;
|
||||
|
||||
ras_ptr->reset();
|
||||
ras_ptr->gamma(agg::gamma_power());
|
||||
agg::scanline_u8 sl;
|
||||
agg::rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_ * 4);
|
||||
pixfmt pixf(buf);
|
||||
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
||||
pixfmt_comp_type pixf(buf);
|
||||
pixf.comp_op(static_cast<agg::comp_op_e>(comp_op));
|
||||
renderer_base renb(pixf);
|
||||
|
||||
|
||||
box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
|
||||
coord<double,2> c = bbox.center();
|
||||
// center the svg marker on '0,0'
|
||||
|
@ -277,19 +283,19 @@ void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& mar
|
|||
svg_path_adapter svg_path(stl_storage);
|
||||
svg_renderer<svg_path_adapter,
|
||||
agg::pod_bvector<path_attributes>,
|
||||
renderer_solid,
|
||||
renderer_type,
|
||||
agg::pixfmt_rgba32> svg_renderer(svg_path,
|
||||
(*marker.get_vector_data())->attributes());
|
||||
|
||||
svg_renderer.render(*ras_ptr, sl, renb, mtx, opacity, bbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: Add subpixel support
|
||||
pixmap_.set_rectangle_alpha2(**marker.get_bitmap_data(),
|
||||
boost::math::iround(pos.x),
|
||||
boost::math::iround(pos.y),
|
||||
opacity);
|
||||
{
|
||||
composite(current_buffer_->data(), **marker.get_bitmap_data(),
|
||||
comp_op, opacity,
|
||||
boost::math::iround(pos.x),
|
||||
boost::math::iround(pos.y),
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,19 +55,23 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
typedef agg::pixfmt_rgba32 pixfmt;
|
||||
typedef agg::renderer_base<pixfmt> renderer_base;
|
||||
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
|
||||
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgba order_type;
|
||||
typedef agg::pixel32_type pixel_type;
|
||||
typedef agg::comp_op_adaptor_rgba<color_type, order_type> blender_type; // comp blender
|
||||
typedef agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer> pixfmt_comp_type;
|
||||
typedef agg::renderer_base<pixfmt_comp_type> renderer_base;
|
||||
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_type;
|
||||
|
||||
ras_ptr->reset();
|
||||
ras_ptr->gamma(agg::gamma_power());
|
||||
agg::scanline_u8 sl;
|
||||
agg::scanline_p8 sl_line;
|
||||
agg::rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_ * 4);
|
||||
pixfmt pixf(buf);
|
||||
pixfmt_comp_type pixf(buf);
|
||||
pixf.comp_op(static_cast<agg::comp_op_e>(sym.comp_op()));
|
||||
renderer_base renb(pixf);
|
||||
renderer_solid ren(renb);
|
||||
renderer_type ren(renb);
|
||||
agg::trans_affine tr;
|
||||
boost::array<double,6> const& m = sym.get_image_transform();
|
||||
tr.load_from(&m[0]);
|
||||
|
@ -104,9 +108,10 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
using namespace mapnik::svg;
|
||||
vertex_stl_adapter<svg_path_storage> stl_storage((*marker)->source());
|
||||
svg_path_adapter svg_path(stl_storage);
|
||||
|
||||
svg_renderer<svg_path_adapter,
|
||||
agg::pod_bvector<path_attributes>,
|
||||
renderer_solid,
|
||||
renderer_type,
|
||||
agg::pixfmt_rgba32 > svg_renderer(svg_path,(*marker)->attributes());
|
||||
|
||||
for (unsigned i=0; i<feature->num_geometries(); ++i)
|
||||
|
@ -127,7 +132,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
detector_->has_placement(extent))
|
||||
{
|
||||
|
||||
render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**mark, tr, sym.get_opacity());
|
||||
render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**mark, tr, sym.get_opacity(), sym.comp_op());
|
||||
|
||||
// TODO - impl this for markers?
|
||||
//if (!sym.get_ignore_placement())
|
||||
|
|
|
@ -103,7 +103,7 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
|
|||
detector_->has_placement(label_ext))
|
||||
{
|
||||
|
||||
render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**marker,tr, sym.get_opacity());
|
||||
render_marker(pixel_position(x - 0.5 * w, y - 0.5 * h) ,**marker,tr, sym.get_opacity(), sym.comp_op());
|
||||
|
||||
if (!sym.get_ignore_placement())
|
||||
detector_->insert(label_ext);
|
||||
|
|
|
@ -55,7 +55,8 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
|
|||
render_marker(helper.get_marker_position(placements[ii]),
|
||||
helper.get_marker(),
|
||||
helper.get_image_transform(),
|
||||
sym.get_opacity());
|
||||
sym.get_opacity(),
|
||||
sym.comp_op());
|
||||
|
||||
ren.prepare_glyphs(&(placements[ii]));
|
||||
ren.render(placements[ii].center);
|
||||
|
|
|
@ -44,9 +44,9 @@ gradient::gradient()
|
|||
x2_(0),
|
||||
y2_(0),
|
||||
r_(0),
|
||||
units_(OBJECT_BOUNDING_BOX)
|
||||
{
|
||||
}
|
||||
units_(OBJECT_BOUNDING_BOX),
|
||||
transform_()
|
||||
{}
|
||||
|
||||
gradient::gradient(gradient const& other)
|
||||
: gradient_type_(other.gradient_type_),
|
||||
|
@ -77,11 +77,11 @@ gradient_e gradient::get_gradient_type() const
|
|||
return gradient_type_;
|
||||
}
|
||||
|
||||
void gradient::set_transform(agg::trans_affine transform)
|
||||
void gradient::set_transform(agg::trans_affine const& transform)
|
||||
{
|
||||
transform_ = transform;
|
||||
}
|
||||
agg::trans_affine gradient::get_transform() const
|
||||
agg::trans_affine const& gradient::get_transform() const
|
||||
{
|
||||
return transform_;
|
||||
}
|
||||
|
|
|
@ -1031,7 +1031,7 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym)
|
|||
}
|
||||
boost::array<double,6> matrix;
|
||||
tr.store_to(&matrix[0]);
|
||||
symbol.set_transform(matrix);
|
||||
symbol.set_image_transform(matrix);
|
||||
}
|
||||
|
||||
optional<color> c = sym.get_opt_attr<color>("fill");
|
||||
|
|
Loading…
Reference in a new issue