text symbilizer : add halo-opactity property (#2268)

This commit is contained in:
artemp 2014-06-16 11:24:16 +01:00
parent 91a523733b
commit cbab56fa79
3 changed files with 8 additions and 4 deletions

View File

@ -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<font_set> 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;

View File

@ -176,7 +176,7 @@ void agg_text_renderer<T>::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<T>::render(glyph_positions const& pos)
bit->left,
height - bit->top,
halo_radius,
format->text_opacity,
format->halo_opacity,
comp_op_);
}
}

View File

@ -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<double> opacity_ = node.get_opt_attr<double>("opacity");
if (opacity_) text_opacity = *opacity_;
optional<double> halo_opacity_ = node.get_opt_attr<double>("halo-opacity");
if (halo_opacity_) halo_opacity = *halo_opacity_;
optional<std::string> wrap_char_ = node.get_opt_attr<std::string>("wrap-character");
if (wrap_char_ && (*wrap_char_).size() > 0) wrap_char = ((*wrap_char_)[0]);
optional<std::string> face_name_ = node.get_opt_attr<std::string>("face-name");