1
//----------------------------------------------------------------------------
2
// Anti-Grain Geometry - Version 2.4
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5
// Permission to copy, use, modify, sell and distribute this software
6
// is granted provided this copyright notice appears in all copies.
7
// This software is provided "as is" without express or implied
8
// warranty, and with no claim as to its suitability for any purpose.
10
//----------------------------------------------------------------------------
11
// Contact: mcseem@antigrain.com
12
// mcseemagg@yahoo.com
13
// http://www.antigrain.com
14
//----------------------------------------------------------------------------
16
#ifndef AGG_CONV_CLOSE_POLYGON_INCLUDED
17
#define AGG_CONV_CLOSE_POLYGON_INCLUDED
19
#include "agg_basics.h"
24
//======================================================conv_close_polygon
25
template<class VertexSource> class conv_close_polygon
28
explicit conv_close_polygon(VertexSource& vs) : m_source(&vs) {}
29
void attach(VertexSource& source) { m_source = &source; }
31
void rewind(unsigned path_id);
32
unsigned vertex(double* x, double* y);
35
conv_close_polygon(const conv_close_polygon<VertexSource>&);
36
const conv_close_polygon<VertexSource>&
37
operator = (const conv_close_polygon<VertexSource>&);
39
VertexSource* m_source;
49
//------------------------------------------------------------------------
50
template<class VertexSource>
51
void conv_close_polygon<VertexSource>::rewind(unsigned path_id)
53
m_source->rewind(path_id);
60
//------------------------------------------------------------------------
61
template<class VertexSource>
62
unsigned conv_close_polygon<VertexSource>::vertex(double* x, double* y)
64
unsigned cmd = path_cmd_stop;
71
cmd = m_cmd[m_vertex];
76
cmd = m_source->vertex(x, y);
80
cmd |= path_flags_close;
88
m_cmd[0] = path_cmd_end_poly | path_flags_close;
89
m_cmd[1] = path_cmd_stop;
103
m_cmd[0] = path_cmd_end_poly | path_flags_close;