+ apply scale_factor to raster markers (bilinear)
This commit is contained in:
parent
34c3128b0c
commit
caa50402dc
1 changed files with 34 additions and 15 deletions
|
@ -36,6 +36,7 @@
|
|||
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||
#include <mapnik/image_compositing.hpp>
|
||||
#include <mapnik/image_filter.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
// agg
|
||||
#define AGG_RENDERING_BUFFER row_ptr_cache<int8u>
|
||||
#include "agg_rendering_buffer.h"
|
||||
|
@ -303,13 +304,31 @@ void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& mar
|
|||
}
|
||||
else
|
||||
{
|
||||
double cx = 0.5 * (*marker.get_bitmap_data())->width();
|
||||
double cy = 0.5 * (*marker.get_bitmap_data())->height();
|
||||
composite(current_buffer_->data(), **marker.get_bitmap_data(),
|
||||
comp_op, opacity,
|
||||
boost::math::iround(pos.x - cx),
|
||||
boost::math::iround(pos.y - cy),
|
||||
false);
|
||||
double w = (*marker.get_bitmap_data())->width();
|
||||
double h = (*marker.get_bitmap_data())->height();
|
||||
double cx = 0.5 * w;
|
||||
double cy = 0.5 * h;
|
||||
|
||||
if (std::fabs(1.0 - scale_factor_) < 0.001)
|
||||
{
|
||||
composite(current_buffer_->data(), **marker.get_bitmap_data(),
|
||||
comp_op, opacity,
|
||||
boost::math::iround(pos.x - cx),
|
||||
boost::math::iround(pos.y - cy),
|
||||
false);
|
||||
}
|
||||
else
|
||||
{
|
||||
double scaled_width = w * scale_factor_;
|
||||
double scaled_height = h * scale_factor_;
|
||||
image_data_32 buf(std::ceil(scaled_width),std::ceil(scaled_height));
|
||||
scale_image_agg(buf, **marker.get_bitmap_data(), SCALING_BILINEAR, scale_factor_);
|
||||
composite(current_buffer_->data(), buf,
|
||||
comp_op, opacity,
|
||||
boost::math::iround(pos.x - 0.5*scaled_width),
|
||||
boost::math::iround(pos.y - 0.5*scaled_height),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue