From cbab56fa790e37ebd207fe639ef9fcf5beaaa353 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 16 Jun 2014 11:24:16 +0100 Subject: [PATCH] text symbilizer : add halo-opactity property (#2268) --- include/mapnik/text/text_properties.hpp | 5 +++-- src/text/renderer.cpp | 4 ++-- src/text/text_properties.cpp | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/mapnik/text/text_properties.hpp b/include/mapnik/text/text_properties.hpp index 6ff783bf4..91e2c0dab 100644 --- a/include/mapnik/text/text_properties.hpp +++ b/include/mapnik/text/text_properties.hpp @@ -60,15 +60,16 @@ struct MAPNIK_DECL char_properties { char_properties(); /** Construct object from XML. */ - void from_xml(xml_node const &sym, fontset_map const & fontsets); + void from_xml(xml_node const& sym, fontset_map const& fontsets); /** Write object to XML ptree. */ - void to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const& dfl=char_properties()) const; + void to_xml(boost::property_tree::ptree& node, bool explicit_defaults, char_properties const& dfl=char_properties()) const; std::string face_name; boost::optional fontset; double text_size; double character_spacing; double line_spacing; //Largest total height (fontsize+line_spacing) per line is chosen double text_opacity; + double halo_opacity; unsigned wrap_char; text_transform_e text_transform; //Per expression color fill; diff --git a/src/text/renderer.cpp b/src/text/renderer.cpp index ec1ca32bb..996cbd3a6 100644 --- a/src/text/renderer.cpp +++ b/src/text/renderer.cpp @@ -176,7 +176,7 @@ void agg_text_renderer::render(glyph_positions const& pos) format->halo_fill.rgba(), bit->left, height - bit->top, - format->text_opacity, + format->halo_opacity, comp_op_); } } @@ -191,7 +191,7 @@ void agg_text_renderer::render(glyph_positions const& pos) bit->left, height - bit->top, halo_radius, - format->text_opacity, + format->halo_opacity, comp_op_); } } diff --git a/src/text/text_properties.cpp b/src/text/text_properties.cpp index e0433347d..b11741e7b 100644 --- a/src/text/text_properties.cpp +++ b/src/text/text_properties.cpp @@ -354,6 +354,7 @@ char_properties::char_properties() : character_spacing(0), line_spacing(0), text_opacity(1.0), + halo_opacity(1.0), wrap_char(' '), text_transform(NONE), fill(color(0,0,0)), @@ -381,6 +382,8 @@ void char_properties::from_xml(xml_node const& node, fontset_map const& fontsets if (line_spacing_) line_spacing = *line_spacing_; optional opacity_ = node.get_opt_attr("opacity"); if (opacity_) text_opacity = *opacity_; + optional halo_opacity_ = node.get_opt_attr("halo-opacity"); + if (halo_opacity_) halo_opacity = *halo_opacity_; optional wrap_char_ = node.get_opt_attr("wrap-character"); if (wrap_char_ && (*wrap_char_).size() > 0) wrap_char = ((*wrap_char_)[0]); optional face_name_ = node.get_opt_attr("face-name");