/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ // mapnik #include #include #include #include #include #include #include #include #include #include #include #include // stl #include #pragma GCC diagnostic push #include #include "agg_basics.h" #include "agg_rendering_buffer.h" #include "agg_color_rgba.h" #include "agg_pixfmt_rgba.h" #include "agg_rasterizer_scanline_aa.h" #include "agg_scanline_u.h" #include "agg_renderer_scanline.h" #include "agg_conv_stroke.h" #pragma GCC diagnostic pop namespace mapnik { template void agg_renderer::process(building_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { using transform_path_type = transform_path_adapter; using ren_base = agg::renderer_base; using renderer = agg::renderer_scanline_aa_solid; agg::rendering_buffer buf(current_buffer_->bytes(),current_buffer_->width(),current_buffer_->height(), current_buffer_->row_size()); agg::pixfmt_rgba32_pre pixf(buf); ren_base renb(pixf); value_double opacity = get(sym,feature, common_.vars_); color const& fill = get(sym, feature, common_.vars_); unsigned r=fill.red(); unsigned g=fill.green(); unsigned b=fill.blue(); unsigned a=fill.alpha(); renderer ren(renb); agg::scanline_u8 sl; ras_ptr->reset(); double gamma = get(sym, feature, common_.vars_); gamma_method_enum gamma_method = get(sym, feature, common_.vars_); if (gamma != gamma_ || gamma_method != gamma_method_) { set_gamma_method(ras_ptr, gamma, gamma_method); gamma_method_ = gamma_method; gamma_ = gamma; } double height = get(sym, feature, common_.vars_) * common_.scale_factor_; render_building_symbolizer( feature, height, [&,r,g,b,a,opacity](path_type const& faces) { vertex_adapter va(faces); transform_path_type faces_path (this->common_.t_,va,prj_trans); ras_ptr->add_path(faces_path); ren.color(agg::rgba8_pre(int(r*0.8), int(g*0.8), int(b*0.8), int(a * opacity))); agg::render_scanlines(*ras_ptr, sl, ren); this->ras_ptr->reset(); }, [&,r,g,b,a,opacity](path_type const& frame) { vertex_adapter va(frame); transform_path_type path(common_.t_,va, prj_trans); agg::conv_stroke stroke(path); stroke.width(common_.scale_factor_); ras_ptr->add_path(stroke); ren.color(agg::rgba8_pre(int(r*0.8), int(g*0.8), int(b*0.8), int(a * opacity))); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); }, [&,r,g,b,a,opacity](path_type const& roof) { vertex_adapter va(roof); transform_path_type roof_path (common_.t_,va,prj_trans); ras_ptr->add_path(roof_path); ren.color(agg::rgba8_pre(r, g, b, int(a * opacity))); agg::render_scanlines(*ras_ptr, sl, ren); }); } template void agg_renderer::process(building_symbolizer const&, mapnik::feature_impl &, proj_transform const&); }