render_pattern() needs its own rasterizer
This commit is contained in:
parent
0a7665a52d
commit
73b8369178
6 changed files with 13 additions and 17 deletions
|
@ -52,10 +52,9 @@ struct cairo_renderer_process_visitor_p
|
|||
|
||||
void operator() (marker_svg const& marker)
|
||||
{
|
||||
mapnik::rasterizer ras;
|
||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr_;
|
||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<image_rgba8>(ras, marker, image_tr_, 1.0, image);
|
||||
render_pattern<image_rgba8>(marker, image_tr_, 1.0, image);
|
||||
cairo_pattern pattern(image, opacity_);
|
||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||
pattern.set_origin(offset_x_, offset_y_);
|
||||
|
|
|
@ -38,8 +38,7 @@ struct rasterizer;
|
|||
struct marker_svg;
|
||||
|
||||
template <typename T>
|
||||
void render_pattern(rasterizer & ras,
|
||||
marker_svg const& marker,
|
||||
void render_pattern(marker_svg const& marker,
|
||||
agg::trans_affine const& tr,
|
||||
double opacity,
|
||||
T & image);
|
||||
|
|
|
@ -199,7 +199,7 @@ struct agg_renderer_process_visitor_l
|
|||
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
|
||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||
image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<buffer_type>(ras_, marker, image_tr, 1.0, image);
|
||||
render_pattern<buffer_type>(marker, image_tr, 1.0, image);
|
||||
render_by_pattern_type(image);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ struct agg_renderer_process_visitor_p
|
|||
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
|
||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image);
|
||||
render_pattern<buffer_type>(marker, image_tr, 1.0, image);
|
||||
render(image);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,12 @@ struct prepare_pattern_visitor
|
|||
std::shared_ptr<cairo_pattern> operator() (mapnik::marker_svg const& marker)
|
||||
{
|
||||
double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_);
|
||||
mapnik::rasterizer ras;
|
||||
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
|
||||
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
|
||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
||||
render_pattern<image_rgba8>(ras, marker, image_tr, 1.0, image);
|
||||
render_pattern<image_rgba8>(marker, image_tr, 1.0, image);
|
||||
width_ = image.width();
|
||||
height_ = image.height();
|
||||
return std::make_shared<cairo_pattern>(image, opacity);
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
namespace mapnik {
|
||||
|
||||
template <>
|
||||
void render_pattern<image_rgba8>(rasterizer & ras,
|
||||
marker_svg const& marker,
|
||||
void render_pattern<image_rgba8>(marker_svg const& marker,
|
||||
agg::trans_affine const& tr,
|
||||
double opacity,
|
||||
image_rgba8 & image)
|
||||
|
@ -62,13 +61,13 @@ void render_pattern<image_rgba8>(rasterizer & ras,
|
|||
pixfmt pixf(buf);
|
||||
renderer_base renb(pixf);
|
||||
|
||||
mapnik::svg::vertex_stl_adapter<mapnik::svg::svg_path_storage> stl_storage(marker.get_data()->source());
|
||||
mapnik::svg::svg_path_adapter svg_path(stl_storage);
|
||||
mapnik::svg::svg_renderer_agg<mapnik::svg::svg_path_adapter,
|
||||
agg::pod_bvector<mapnik::svg::path_attributes>,
|
||||
renderer_solid,
|
||||
pixfmt > svg_renderer(svg_path,
|
||||
marker.get_data()->attributes());
|
||||
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(marker.get_data()->source());
|
||||
svg_path_adapter svg_path(stl_storage);
|
||||
svg::svg_renderer_agg<svg_path_adapter,
|
||||
svg_attribute_type,
|
||||
renderer_solid,
|
||||
pixfmt> svg_renderer(svg_path, marker.get_data()->attributes());
|
||||
rasterizer ras;
|
||||
|
||||
svg_renderer.render(ras, sl, renb, mtx, opacity, bbox);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue