1 
2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 //
6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
10 //
11 //----------------------------------------------------------------------------
12 // Contact: mcseem@antigrain.com
13 //          mcseemagg@yahoo.com
14 //          http://www.antigrain.com
15 //----------------------------------------------------------------------------
16 #ifndef AGG_RENDER_SCANLINES_INCLUDED
17 #define AGG_RENDER_SCANLINES_INCLUDED
18 #include "agg_basics.h"
19 namespace agg
20 {
21 template<class Rasterizer, class Scanline, class Renderer>
render_scanlines(Rasterizer & ras,Scanline & sl,Renderer & ren,bool no_smooth)22 void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren, bool no_smooth)
23 {
24     if(ras.rewind_scanlines()) {
25         sl.reset(ras.min_x(), ras.max_x());
26         ren.prepare(unsigned(ras.max_x() - ras.min_x() + 2));
27         while(ras.sweep_scanline(sl, no_smooth)) {
28             ren.render(sl);
29         }
30     }
31 }
32 template<class Rasterizer, class Scanline, class Renderer,
33          class VertexSource, class ColorStorage, class PathId>
render_all_paths(Rasterizer & ras,Scanline & sl,Renderer & r,VertexSource & vs,const ColorStorage & as,const PathId & path_id,unsigned num_paths)34 void render_all_paths(Rasterizer& ras,
35                       Scanline& sl,
36                       Renderer& r,
37                       VertexSource& vs,
38                       const ColorStorage& as,
39                       const PathId& path_id,
40                       unsigned num_paths)
41 {
42     for(unsigned i = 0; i < num_paths; i++) {
43         ras.reset();
44         ras.add_path(vs, path_id[i]);
45         r.color(as[i]);
46         render_scanlines(ras, sl, r);
47     }
48 }
49 }
50 #endif
51