render_pattern() needs its own rasterizer
This commit is contained in:
parent
fcec445a2e
commit
692fc7f107
6 changed files with 7 additions and 10 deletions
|
@ -52,10 +52,9 @@ struct cairo_renderer_process_visitor_p
|
||||||
|
|
||||||
void operator() (marker_svg const& marker)
|
void operator() (marker_svg const& marker)
|
||||||
{
|
{
|
||||||
mapnik::rasterizer ras;
|
|
||||||
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr_;
|
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr_;
|
||||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
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_);
|
cairo_pattern pattern(image, opacity_);
|
||||||
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
pattern.set_extend(CAIRO_EXTEND_REPEAT);
|
||||||
pattern.set_origin(offset_x_, offset_y_);
|
pattern.set_origin(offset_x_, offset_y_);
|
||||||
|
|
|
@ -38,8 +38,7 @@ struct rasterizer;
|
||||||
struct marker_svg;
|
struct marker_svg;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void render_pattern(rasterizer & ras,
|
void render_pattern(marker_svg const& marker,
|
||||||
marker_svg const& marker,
|
|
||||||
agg::trans_affine const& tr,
|
agg::trans_affine const& tr,
|
||||||
double opacity,
|
double opacity,
|
||||||
T & image);
|
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_);
|
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::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||||
image_rgba8 image(bbox_image.width(), bbox_image.height());
|
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);
|
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_);
|
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::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
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);
|
render(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,13 +65,12 @@ struct prepare_pattern_visitor
|
||||||
std::shared_ptr<cairo_pattern> operator() (mapnik::marker_svg const& marker)
|
std::shared_ptr<cairo_pattern> operator() (mapnik::marker_svg const& marker)
|
||||||
{
|
{
|
||||||
double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_);
|
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_);
|
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
|
||||||
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
|
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_);
|
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::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
|
||||||
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
|
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();
|
width_ = image.width();
|
||||||
height_ = image.height();
|
height_ = image.height();
|
||||||
return std::make_shared<cairo_pattern>(image, opacity);
|
return std::make_shared<cairo_pattern>(image, opacity);
|
||||||
|
|
|
@ -41,8 +41,7 @@
|
||||||
namespace mapnik {
|
namespace mapnik {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void render_pattern<image_rgba8>(rasterizer & ras,
|
void render_pattern<image_rgba8>(marker_svg const& marker,
|
||||||
marker_svg const& marker,
|
|
||||||
agg::trans_affine const& tr,
|
agg::trans_affine const& tr,
|
||||||
double opacity,
|
double opacity,
|
||||||
image_rgba8 & image)
|
image_rgba8 & image)
|
||||||
|
@ -68,6 +67,7 @@ void render_pattern<image_rgba8>(rasterizer & ras,
|
||||||
svg_attribute_type,
|
svg_attribute_type,
|
||||||
renderer_solid,
|
renderer_solid,
|
||||||
pixfmt> svg_renderer(svg_path, marker.get_data()->attributes());
|
pixfmt> svg_renderer(svg_path, marker.get_data()->attributes());
|
||||||
|
rasterizer ras;
|
||||||
|
|
||||||
svg_renderer.render(ras, sl, renb, mtx, opacity, bbox);
|
svg_renderer.render(ras, sl, renb, mtx, opacity, bbox);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue