pass scale_factor to text_renderer in order to scale up halo_radius - refs #1273 and refs #695

This commit is contained in:
Dane Springmeyer 2012-06-29 13:05:28 -07:00
parent ef893b5b5f
commit 7f531498c6
6 changed files with 36 additions and 10 deletions

View file

@ -360,7 +360,11 @@ struct text_renderer : private boost::noncopyable
typedef boost::ptr_vector<glyph_t> glyphs_t;
typedef T pixmap_type;
text_renderer (pixmap_type & pixmap, face_manager<freetype_engine> &font_manager_, stroker & s, composite_mode_e comp_op = src_over);
text_renderer (pixmap_type & pixmap,
face_manager<freetype_engine> &font_manager_,
stroker & s,
composite_mode_e comp_op = src_over,
double scale_factor=1.0);
box2d<double> prepare_glyphs(text_path *path);
void render(pixel_position pos);
void render_id(int feature_id, pixel_position pos, double min_radius=1.0);
@ -411,6 +415,7 @@ private:
stroker & stroker_;
glyphs_t glyphs_;
composite_mode_e comp_op_;
double scale_factor_;
};
typedef face_manager<freetype_engine> face_manager_freetype;

View file

@ -46,7 +46,11 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
scale_factor_,
t_, font_manager_, *detector_, query_extent_);
text_renderer<T> ren(*current_buffer_, font_manager_, *(font_manager_.get_stroker()));
text_renderer<T> ren(*current_buffer_,
font_manager_,
*(font_manager_.get_stroker()),
sym.comp_op(),
scale_factor_);
while (helper.next()) {
placements_type &placements = helper.placements();

View file

@ -39,7 +39,11 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
scale_factor_,
t_, font_manager_, *detector_, query_extent_);
text_renderer<T> ren(*current_buffer_, font_manager_, *(font_manager_.get_stroker()), sym.comp_op());
text_renderer<T> ren(*current_buffer_,
font_manager_,
*(font_manager_.get_stroker()),
sym.comp_op(),
scale_factor_);
while (helper.next())
{

View file

@ -315,11 +315,16 @@ void font_face_set::get_string_info(string_info & info, UnicodeString const& ust
}
template <typename T>
text_renderer<T>::text_renderer (pixmap_type & pixmap, face_manager<freetype_engine> &font_manager_, stroker & s, composite_mode_e comp_op)
text_renderer<T>::text_renderer (pixmap_type & pixmap,
face_manager<freetype_engine> &font_manager_,
stroker & s,
composite_mode_e comp_op,
double scale_factor)
: pixmap_(pixmap),
font_manager_(font_manager_),
stroker_(s),
comp_op_(comp_op) {}
comp_op_(comp_op),
scale_factor_(scale_factor) {}
template <typename T>
box2d<double> text_renderer<T>::prepare_glyphs(text_path *path)
@ -433,7 +438,7 @@ void text_renderer<T>::render(pixel_position pos)
typename glyphs_t::iterator itr;
for (itr = glyphs_.begin(); itr != glyphs_.end(); ++itr)
{
double halo_radius = itr->properties->halo_radius;
double halo_radius = itr->properties->halo_radius * scale_factor_;
//make sure we've got reasonable values.
if (halo_radius <= 0.0 || halo_radius > 1024.0) continue;
stroker_.init(halo_radius);
@ -525,10 +530,10 @@ boost::mutex freetype_engine::mutex_;
#endif
std::map<std::string,std::pair<int,std::string> > freetype_engine::name2file_;
template void text_renderer<image_32>::render(pixel_position);
template text_renderer<image_32>::text_renderer(image_32&, face_manager<freetype_engine>&, stroker&, composite_mode_e);
template text_renderer<image_32>::text_renderer(image_32&, face_manager<freetype_engine>&, stroker&, composite_mode_e, double);
template box2d<double>text_renderer<image_32>::prepare_glyphs(text_path*);
template void text_renderer<grid>::render_id(int, pixel_position, double );
template text_renderer<grid>::text_renderer(grid&, face_manager<freetype_engine>&, stroker&, composite_mode_e);
template text_renderer<grid>::text_renderer(grid&, face_manager<freetype_engine>&, stroker&, composite_mode_e, double);
template box2d<double>text_renderer<grid>::prepare_glyphs(text_path*);
}

View file

@ -51,7 +51,11 @@ void grid_renderer<T>::process(shield_symbolizer const& sym,
bool placement_found = false;
text_renderer<T> ren(pixmap_, font_manager_, *(font_manager_.get_stroker()));
text_renderer<T> ren(pixmap_,
font_manager_,
*(font_manager_.get_stroker()),
sym.comp_op(),
scale_factor_);
text_placement_info_ptr placement;
while (helper.next()) {

View file

@ -41,7 +41,11 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
query_extent);
bool placement_found = false;
text_renderer<T> ren(pixmap_, font_manager_, *(font_manager_.get_stroker()));
text_renderer<T> ren(pixmap_,
font_manager_,
*(font_manager_.get_stroker()),
sym.comp_op(),
scale_factor_);
while (helper.next()) {
placement_found = true;