Remove text opacity.
This commit is contained in:
parent
afb2eedbb9
commit
fb2b1ae2f2
15 changed files with 10 additions and 69 deletions
|
@ -197,10 +197,6 @@ void export_shield_symbolizer()
|
|||
.add_property("shield_displacement",
|
||||
get_shield_displacement,
|
||||
set_shield_displacement)
|
||||
.add_property("text_opacity",
|
||||
&shield_symbolizer::get_text_opacity,
|
||||
&shield_symbolizer::set_text_opacity,
|
||||
"Set/get the text opacity")
|
||||
.add_property("text_transform",
|
||||
&shield_symbolizer::get_text_transform,
|
||||
&shield_symbolizer::set_text_transform,
|
||||
|
|
|
@ -127,7 +127,6 @@ void export_text_placement()
|
|||
.def_readwrite("text_size", &char_properties::text_size)
|
||||
.def_readwrite("character_spacing", &char_properties::character_spacing)
|
||||
.def_readwrite("line_spacing", &char_properties::line_spacing)
|
||||
.def_readwrite("text_opacity", &char_properties::text_opacity)
|
||||
.def_readwrite("wrap_char", &char_properties::wrap_char)
|
||||
.def_readwrite("wrap_before", &char_properties::wrap_before)
|
||||
.def_readwrite("text_transform", &char_properties::text_transform)
|
||||
|
|
|
@ -76,7 +76,6 @@ struct text_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
extras.append(t.get_wrap_before());
|
||||
extras.append(t.get_horizontal_alignment());
|
||||
extras.append(t.get_justify_alignment());
|
||||
extras.append(t.get_text_opacity());
|
||||
extras.append(t.get_minimum_padding());
|
||||
extras.append(t.get_minimum_path_length());
|
||||
|
||||
|
@ -135,9 +134,8 @@ struct text_symbolizer_pickle_suite : boost::python::pickle_suite
|
|||
t.set_wrap_before(extract<bool>(extras[4]));
|
||||
t.set_horizontal_alignment(extract<horizontal_alignment_e>(extras[5]));
|
||||
t.set_justify_alignment(extract<justify_alignment_e>(extras[6]));
|
||||
t.set_text_opacity(extract<double>(extras[7]));
|
||||
t.set_minimum_padding(extract<double>(extras[8]));
|
||||
t.set_minimum_path_length(extract<double>(extras[9]));
|
||||
t.set_minimum_padding(extract<double>(extras[7]));
|
||||
t.set_minimum_path_length(extract<double>(extras[8]));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -231,10 +229,6 @@ void export_text_symbolizer()
|
|||
&text_symbolizer::set_minimum_path_length)
|
||||
.add_property("name",&text_symbolizer::get_name,
|
||||
&text_symbolizer::set_name)
|
||||
.add_property("opacity",
|
||||
&text_symbolizer::get_text_opacity,
|
||||
&text_symbolizer::set_text_opacity,
|
||||
"Set/get the text opacity")
|
||||
.add_property("text_transform",
|
||||
&text_symbolizer::get_text_transform,
|
||||
&text_symbolizer::set_text_transform,
|
||||
|
|
|
@ -349,7 +349,7 @@ struct text_renderer : private boost::noncopyable
|
|||
void render_id(int feature_id,double x0, double y0, double min_radius=1.0);
|
||||
|
||||
private:
|
||||
void render_bitmap(FT_Bitmap *bitmap, unsigned rgba, int x, int y, double opacity)
|
||||
void render_bitmap(FT_Bitmap *bitmap, unsigned rgba, int x, int y)
|
||||
{
|
||||
int x_max=x+bitmap->width;
|
||||
int y_max=y+bitmap->rows;
|
||||
|
@ -362,7 +362,7 @@ private:
|
|||
int gray=bitmap->buffer[q*bitmap->width+p];
|
||||
if (gray)
|
||||
{
|
||||
pixmap_.blendPixel2(i, j, rgba, gray, opacity);
|
||||
pixmap_.blendPixel(i, j, rgba, gray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ public:
|
|||
boost::optional<unsigned> text_size;
|
||||
boost::optional<unsigned> character_spacing;
|
||||
boost::optional<unsigned> line_spacing;
|
||||
boost::optional<double> text_opacity;
|
||||
boost::optional<bool> wrap_before;
|
||||
boost::optional<unsigned> wrap_char;
|
||||
boost::optional<text_transform_e> text_transform;
|
||||
|
|
|
@ -214,17 +214,12 @@ public:
|
|||
}
|
||||
}
|
||||
inline void blendPixel(int x,int y,unsigned int rgba1,int t)
|
||||
{
|
||||
blendPixel2(x,y,rgba1,t,1.0); // do not change opacity
|
||||
}
|
||||
|
||||
inline void blendPixel2(int x,int y,unsigned int rgba1,int t,double opacity)
|
||||
{
|
||||
if (checkBounds(x,y))
|
||||
{
|
||||
unsigned rgba0 = data_(x,y);
|
||||
#ifdef MAPNIK_BIG_ENDIAN
|
||||
unsigned a1 = (int)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
unsigned a1 = (int)(rgba1 & 0xff);
|
||||
a1 = (t*a1) / 255;
|
||||
if (a1 == 0) return;
|
||||
unsigned r1 = (rgba1 >> 24) & 0xff;
|
||||
|
@ -244,7 +239,7 @@ public:
|
|||
a0 = a0 >> 8;
|
||||
data_(x,y)= (a0)| (b0 << 8) | (g0 << 16) | (r0 << 24) ;
|
||||
#else
|
||||
unsigned a1 = (int)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
unsigned a1 = (int)((rgba1 >> 24) & 0xff);
|
||||
a1 = (t*a1) / 255;
|
||||
if (a1 == 0) return;
|
||||
unsigned r1 = rgba1 & 0xff;
|
||||
|
|
|
@ -265,19 +265,14 @@ public:
|
|||
}
|
||||
|
||||
inline void blendPixel(value_type feature_id,int x,int y,unsigned int rgba1,int t)
|
||||
{
|
||||
blendPixel2(feature_id ,x,y,rgba1,t,1.0); // do not change opacity
|
||||
}
|
||||
|
||||
inline void blendPixel2(value_type feature_id,int x,int y,unsigned int rgba1,int t,double opacity)
|
||||
{
|
||||
if (checkBounds(x,y))
|
||||
{
|
||||
|
||||
#ifdef MAPNIK_BIG_ENDIAN
|
||||
unsigned a = (int)((rgba1 & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
unsigned a = (int)(rgba1 & 0xff); // adjust for desired opacity
|
||||
#else
|
||||
unsigned a = (int)(((rgba1 >> 24) & 0xff) * opacity) & 0xff; // adjust for desired opacity
|
||||
unsigned a = (int)((rgba1 >> 24) & 0xff); // adjust for desired opacity
|
||||
#endif
|
||||
// if the pixel is more than a tenth
|
||||
// opaque then burn in the feature id
|
||||
|
|
|
@ -60,7 +60,6 @@ struct char_properties
|
|||
float text_size;
|
||||
double character_spacing;
|
||||
double line_spacing; //Largest total height (fontsize+line_spacing) per line is chosen
|
||||
double text_opacity;
|
||||
bool wrap_before;
|
||||
unsigned wrap_char;
|
||||
text_transform_e text_transform; //Per expression
|
||||
|
|
|
@ -117,8 +117,6 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base
|
|||
double get_minimum_path_length() const;
|
||||
void set_allow_overlap(bool overlap);
|
||||
bool get_allow_overlap() const func_deprecated;
|
||||
void set_text_opacity(double opacity);
|
||||
double get_text_opacity() const func_deprecated;
|
||||
void set_wrap_before(bool wrap_before);
|
||||
bool get_wrap_before() const func_deprecated; // wrap text at wrap_char immediately before current work
|
||||
void set_horizontal_alignment(horizontal_alignment_e valign);
|
||||
|
|
|
@ -409,7 +409,7 @@ void text_renderer<T>::render(double x0, double y0)
|
|||
FT_BitmapGlyph bit = (FT_BitmapGlyph)g;
|
||||
render_bitmap(&bit->bitmap, pos->properties->halo_fill.rgba(),
|
||||
bit->left,
|
||||
height - bit->top, pos->properties->text_opacity);
|
||||
height - bit->top);
|
||||
}
|
||||
}
|
||||
FT_Done_Glyph(g);
|
||||
|
@ -427,7 +427,7 @@ void text_renderer<T>::render(double x0, double y0)
|
|||
FT_BitmapGlyph bit = (FT_BitmapGlyph)pos->image;
|
||||
render_bitmap(&bit->bitmap, pos->properties->fill.rgba(),
|
||||
bit->left,
|
||||
height - bit->top, pos->properties->text_opacity);
|
||||
height - bit->top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1408,15 +1408,6 @@ void map_parser::parse_shield_symbolizer( rule & rule, ptree const & sym )
|
|||
shield_symbol.set_opacity(*opacity);
|
||||
}
|
||||
|
||||
// text-opacity
|
||||
// TODO: Could be problematic because it is named opacity in TextSymbolizer but opacity has a diffrent meaning here.
|
||||
optional<double> text_opacity =
|
||||
get_opt_attr<double>(sym, "text-opacity");
|
||||
if (text_opacity)
|
||||
{
|
||||
shield_symbol.set_text_opacity( * text_opacity );
|
||||
}
|
||||
|
||||
// unlock_image
|
||||
optional<boolean> unlock_image =
|
||||
get_opt_attr<boolean>(sym, "unlock-image");
|
||||
|
|
|
@ -206,10 +206,6 @@ public:
|
|||
{
|
||||
set_attr(sym_node, "unlock-image", sym.get_unlock_image());
|
||||
}
|
||||
if (sym.get_text_opacity() != dfl.get_text_opacity() || explicit_defaults_)
|
||||
{
|
||||
set_attr(sym_node, "text-opacity", sym.get_text_opacity());
|
||||
}
|
||||
position displacement = sym.get_shield_displacement();
|
||||
if (displacement.first != dfl.get_shield_displacement().first || explicit_defaults_)
|
||||
{
|
||||
|
|
|
@ -233,7 +233,6 @@ char_properties::char_properties() :
|
|||
text_size(10.0),
|
||||
character_spacing(0),
|
||||
line_spacing(0),
|
||||
text_opacity(1.0),
|
||||
wrap_before(false),
|
||||
wrap_char(' '),
|
||||
text_transform(NONE),
|
||||
|
@ -262,8 +261,6 @@ void char_properties::from_xml(boost::property_tree::ptree const &sym, std::map<
|
|||
if (tconvert_) text_transform = *tconvert_;
|
||||
optional<double> line_spacing_ = get_opt_attr<double>(sym, "line-spacing");
|
||||
if (line_spacing_) line_spacing = *line_spacing_;
|
||||
optional<double> opacity_ = get_opt_attr<double>(sym, "opacity");
|
||||
if (opacity_) text_opacity = *opacity_;
|
||||
optional<std::string> wrap_char_ = get_opt_attr<std::string>(sym, "wrap-character");
|
||||
if (wrap_char_ && (*wrap_char_).size() > 0) wrap_char = ((*wrap_char_)[0]);
|
||||
optional<std::string> face_name_ = get_opt_attr<std::string>(sym, "face-name");
|
||||
|
@ -343,11 +340,6 @@ void char_properties::to_xml(boost::property_tree::ptree &node, bool explicit_de
|
|||
{
|
||||
set_attr(node, "character-spacing", character_spacing);
|
||||
}
|
||||
// for shield_symbolizer this is later overridden
|
||||
if (text_opacity != dfl.text_opacity || explicit_defaults)
|
||||
{
|
||||
set_attr(node, "opacity", text_opacity);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
|
@ -206,7 +206,6 @@ void format_node::to_xml(ptree &xml) const
|
|||
if (text_size) set_attr(new_node, "size", *text_size);
|
||||
if (character_spacing) set_attr(new_node, "character-spacing", *character_spacing);
|
||||
if (line_spacing) set_attr(new_node, "line-spacing", *line_spacing);
|
||||
if (text_opacity) set_attr(new_node, "opacity", *text_opacity);
|
||||
if (wrap_before) set_attr(new_node, "wrap-before", *wrap_before);
|
||||
if (wrap_char) set_attr(new_node, "wrap-character", *wrap_char);
|
||||
if (text_transform) set_attr(new_node, "text-transform", *text_transform);
|
||||
|
@ -230,7 +229,6 @@ node_ptr format_node::from_xml(ptree const& xml)
|
|||
n->text_size = get_opt_attr<unsigned>(xml, "size");
|
||||
n->character_spacing = get_opt_attr<unsigned>(xml, "character-spacing");
|
||||
n->line_spacing = get_opt_attr<unsigned>(xml, "line-spacing");
|
||||
n->text_opacity = get_opt_attr<double>(xml, "opactity");
|
||||
boost::optional<boolean> wrap = get_opt_attr<boolean>(xml, "wrap-before");
|
||||
if (wrap) n->wrap_before = *wrap;
|
||||
n->wrap_char = get_opt_attr<unsigned>(xml, "wrap-character");
|
||||
|
@ -249,7 +247,6 @@ void format_node::apply(char_properties const& p, const Feature &feature, proces
|
|||
if (text_size) new_properties.text_size = *text_size;
|
||||
if (character_spacing) new_properties.character_spacing = *character_spacing;
|
||||
if (line_spacing) new_properties.line_spacing = *line_spacing;
|
||||
if (text_opacity) new_properties.text_opacity = *text_opacity;
|
||||
if (wrap_before) new_properties.wrap_before = *wrap_before;
|
||||
if (wrap_char) new_properties.wrap_char = *wrap_char;
|
||||
if (text_transform) new_properties.text_transform = *text_transform;
|
||||
|
|
|
@ -406,16 +406,6 @@ bool text_symbolizer::get_allow_overlap() const
|
|||
return placement_options_->properties.allow_overlap;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_text_opacity(double text_opacity)
|
||||
{
|
||||
placement_options_->properties.default_format.text_opacity = text_opacity;
|
||||
}
|
||||
|
||||
double text_symbolizer::get_text_opacity() const
|
||||
{
|
||||
return placement_options_->properties.default_format.text_opacity;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_vertical_alignment(vertical_alignment_e valign)
|
||||
{
|
||||
placement_options_->properties.valign = valign;
|
||||
|
|
Loading…
Reference in a new issue