+ sync set_color(...) methods

+ fix alpha/opacity calc when processing building_symbolizer
This commit is contained in:
artemp 2013-01-02 16:52:06 +00:00
parent 8b66128c89
commit bc8ea1c5a7

View File

@ -285,12 +285,12 @@ public:
void set_color(color const &color, double opacity = 1.0)
{
set_color(color.red(), color.green(), color.blue(), color.alpha() * opacity / 255.0);
set_color(color.red()/255.0, color.green()/255.0, color.blue()/255.0, color.alpha() * opacity / 255.0);
}
void set_color(int r, int g, int b, double opacity = 1.0)
void set_color(double r, double g, double b, double opacity = 1.0)
{
context_->set_source_rgba(r / 255.0, g / 255.0, b / 255.0, opacity);
context_->set_source_rgba(r, g, b, opacity);
}
void set_operator(composite_mode_e comp_op)
@ -985,8 +985,8 @@ void cairo_renderer_base::process(building_symbolizer const& sym,
faces->line_to(itr->get<0>(), itr->get<1>() + height);
path_type faces_path(t_, *faces, prj_trans);
context.set_color(int(fill.red() * 0.8), int(fill.green() * 0.8),
int(fill.blue() * 0.8), fill.alpha() * sym.get_opacity() / 255.0);
context.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8 / 255.0,
fill.blue() * 0.8 / 255.0, fill.alpha() * sym.get_opacity() / 255.0);
context.add_path(faces_path);
context.fill();
@ -1011,13 +1011,14 @@ void cairo_renderer_base::process(building_symbolizer const& sym,
}
path_type path(t_, *frame, prj_trans);
context.set_color(fill.red()*0.8, fill.green()*0.8, fill.blue()*0.8,sym.get_opacity());
context.set_color(fill.red() * 0.8 / 255.0, fill.green() * 0.8/255.0,
fill.blue() * 0.8 / 255.0, fill.alpha() * sym.get_opacity() / 255.0);
context.set_line_width(scale_factor_);
context.add_path(path);
context.stroke();
path_type roof_path(t_, *roof, prj_trans);
context.set_color(fill, fill.alpha() * sym.get_opacity() / 255.0 );
context.set_color(fill, sym.get_opacity());
context.add_path(roof_path);
context.fill();
}