1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.3
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_UNCLOSE_POLYGON_INCLUDED
17 #define AGG_CONV_UNCLOSE_POLYGON_INCLUDED
19 #include "agg_basics.h"
20 #include "agg_vertex_iterator.h"
24 //====================================================conv_unclose_polygon
25 template<class VertexSource
> class conv_unclose_polygon
28 conv_unclose_polygon(VertexSource
& vs
) : m_source(&vs
) {}
30 void set_source(VertexSource
& source
) { m_source
= &source
; }
32 void rewind(unsigned path_id
)
34 m_source
->rewind(path_id
);
37 unsigned vertex(double* x
, double* y
)
39 unsigned cmd
= m_source
->vertex(x
, y
);
40 if(is_end_poly(cmd
)) cmd
&= ~path_flags_close
;
44 typedef conv_unclose_polygon
<VertexSource
> source_type
;
45 typedef vertex_iterator
<source_type
> iterator
;
46 iterator
begin(unsigned id
) { return iterator(*this, id
); }
47 iterator
end() { return iterator(path_cmd_stop
); }
50 conv_unclose_polygon(const conv_unclose_polygon
<VertexSource
>&);
51 const conv_unclose_polygon
<VertexSource
>&
52 operator = (const conv_unclose_polygon
<VertexSource
>&);
54 VertexSource
* m_source
;