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