xref: /haiku/headers/libs/agg/agg_conv_unclose_polygon.h (revision e39da397f5ff79f2db9f9a3ddf1852b6710578af)
139241fe2SDarkWyrm //----------------------------------------------------------------------------
2*e39da397SStephan Aßmus // Anti-Grain Geometry - Version 2.4
3*e39da397SStephan Aßmus // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
439241fe2SDarkWyrm //
539241fe2SDarkWyrm // Permission to copy, use, modify, sell and distribute this software
639241fe2SDarkWyrm // is granted provided this copyright notice appears in all copies.
739241fe2SDarkWyrm // This software is provided "as is" without express or implied
839241fe2SDarkWyrm // warranty, and with no claim as to its suitability for any purpose.
939241fe2SDarkWyrm //
1039241fe2SDarkWyrm //----------------------------------------------------------------------------
1139241fe2SDarkWyrm // Contact: mcseem@antigrain.com
1239241fe2SDarkWyrm //          mcseemagg@yahoo.com
1339241fe2SDarkWyrm //          http://www.antigrain.com
1439241fe2SDarkWyrm //----------------------------------------------------------------------------
1539241fe2SDarkWyrm 
1639241fe2SDarkWyrm #ifndef AGG_CONV_UNCLOSE_POLYGON_INCLUDED
1739241fe2SDarkWyrm #define AGG_CONV_UNCLOSE_POLYGON_INCLUDED
1839241fe2SDarkWyrm 
1939241fe2SDarkWyrm #include "agg_basics.h"
2039241fe2SDarkWyrm 
2139241fe2SDarkWyrm namespace agg
2239241fe2SDarkWyrm {
2339241fe2SDarkWyrm     //====================================================conv_unclose_polygon
2439241fe2SDarkWyrm     template<class VertexSource> class conv_unclose_polygon
2539241fe2SDarkWyrm     {
2639241fe2SDarkWyrm     public:
conv_unclose_polygon(VertexSource & vs)2739241fe2SDarkWyrm         conv_unclose_polygon(VertexSource& vs) : m_source(&vs) {}
attach(VertexSource & source)28*e39da397SStephan Aßmus         void attach(VertexSource& source) { m_source = &source; }
2939241fe2SDarkWyrm 
rewind(unsigned path_id)3039241fe2SDarkWyrm         void rewind(unsigned path_id)
3139241fe2SDarkWyrm         {
3239241fe2SDarkWyrm             m_source->rewind(path_id);
3339241fe2SDarkWyrm         }
3439241fe2SDarkWyrm 
vertex(double * x,double * y)3539241fe2SDarkWyrm         unsigned vertex(double* x, double* y)
3639241fe2SDarkWyrm         {
3739241fe2SDarkWyrm             unsigned cmd = m_source->vertex(x, y);
3839241fe2SDarkWyrm             if(is_end_poly(cmd)) cmd &= ~path_flags_close;
3939241fe2SDarkWyrm             return cmd;
4039241fe2SDarkWyrm         }
4139241fe2SDarkWyrm 
4239241fe2SDarkWyrm     private:
4339241fe2SDarkWyrm         conv_unclose_polygon(const conv_unclose_polygon<VertexSource>&);
4439241fe2SDarkWyrm         const conv_unclose_polygon<VertexSource>&
4539241fe2SDarkWyrm             operator = (const conv_unclose_polygon<VertexSource>&);
4639241fe2SDarkWyrm 
4739241fe2SDarkWyrm         VertexSource* m_source;
4839241fe2SDarkWyrm     };
4939241fe2SDarkWyrm 
5039241fe2SDarkWyrm }
5139241fe2SDarkWyrm 
5239241fe2SDarkWyrm #endif
53