From 0ea95e8b11bc7aa9280397ed50a20e3bf4c9ed6d Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 23 Jan 2006 10:26:43 +0000 Subject: [PATCH] fixed pattern fill symbolizer --- include/polygon_symbolizer.hpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/include/polygon_symbolizer.hpp b/include/polygon_symbolizer.hpp index 926b29a28..f90c74ec2 100644 --- a/include/polygon_symbolizer.hpp +++ b/include/polygon_symbolizer.hpp @@ -57,17 +57,17 @@ namespace mapnik agg::pixfmt_rgba32 pixf(buf); ren_base renb(pixf); - double r=fill_.red()/255.0; - double g=fill_.green()/255.0; - double b=fill_.blue()/255.0; - double a=fill_.alpha()/255.0; + unsigned r=fill_.red(); + unsigned g=fill_.green(); + unsigned b=fill_.blue(); + unsigned a=fill_.alpha(); renderer ren(renb); agg::rasterizer_scanline_aa<> ras; agg::scanline_u8 sl; ras.clip_box(0,0,image.width(),image.height()); ras.add_path(geom); - ren.color(agg::rgba(r, g, b, a)); + ren.color(agg::rgba8(r, g, b, a)); agg::render_scanlines(ras, sl, ren); } @@ -102,9 +102,7 @@ namespace mapnik void render(geometry_type& geom,Image32& image) const { - /* typedef agg::renderer_base ren_base; - agg::row_ptr_cache buf(image.raw_data(),image.width(),image.height(), image.width()*4); agg::pixfmt_rgba32 pixf(buf); @@ -120,29 +118,29 @@ namespace mapnik wrap_x_type, wrap_y_type> img_source_type; - typedef agg::span_pattern_rgba span_gen_type; - + typedef agg::span_pattern_rgba span_gen_type; typedef agg::renderer_scanline_aa, span_gen_type> renderer_type; - unsigned offset_x = 0; - unsigned offset_y = 0; + double x0,y0; + geom.vertex(&x0,&y0); + geom.rewind(0); + + unsigned offset_x = unsigned(image.width() - x0); + unsigned offset_y = unsigned(image.height() - y0); agg::span_allocator sa; - span_gen_type sg(pattern_rbuf,offset_x, offset_y); + img_source_type img_src(pattern_rbuf); + span_gen_type sg(img_src, offset_x, offset_y); renderer_type rp(renb,sa, sg); agg::rasterizer_scanline_aa<> ras; agg::scanline_u8 sl; ras.clip_box(0,0,image.width(),image.height()); ras.add_path(geom); - agg::render_scanlines(ras, sl, rp); - */ + agg::render_scanlines(ras, sl, rp); } private: