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 // class conv_transform 1739241fe2SDarkWyrm // 1839241fe2SDarkWyrm //---------------------------------------------------------------------------- 1939241fe2SDarkWyrm #ifndef AGG_CONV_TRANSFORM_INCLUDED 2039241fe2SDarkWyrm #define AGG_CONV_TRANSFORM_INCLUDED 2139241fe2SDarkWyrm 2239241fe2SDarkWyrm #include "agg_basics.h" 2339241fe2SDarkWyrm #include "agg_trans_affine.h" 2439241fe2SDarkWyrm 2539241fe2SDarkWyrm namespace agg 2639241fe2SDarkWyrm { 2739241fe2SDarkWyrm 2839241fe2SDarkWyrm //----------------------------------------------------------conv_transform 2939241fe2SDarkWyrm template<class VertexSource, class Transformer=trans_affine> class conv_transform 3039241fe2SDarkWyrm { 3139241fe2SDarkWyrm public: conv_transform(VertexSource & source,const Transformer & tr)3239241fe2SDarkWyrm conv_transform(VertexSource& source, const Transformer& tr) : 3339241fe2SDarkWyrm m_source(&source), m_trans(&tr) {} attach(VertexSource & source)34*e39da397SStephan Aßmus void attach(VertexSource& source) { m_source = &source; } 3539241fe2SDarkWyrm rewind(unsigned path_id)36*e39da397SStephan Aßmus void rewind(unsigned path_id) 3739241fe2SDarkWyrm { 38*e39da397SStephan Aßmus m_source->rewind(path_id); 3939241fe2SDarkWyrm } 4039241fe2SDarkWyrm vertex(double * x,double * y)4139241fe2SDarkWyrm unsigned vertex(double* x, double* y) 4239241fe2SDarkWyrm { 4339241fe2SDarkWyrm unsigned cmd = m_source->vertex(x, y); 4439241fe2SDarkWyrm if(is_vertex(cmd)) 4539241fe2SDarkWyrm { 4639241fe2SDarkWyrm m_trans->transform(x, y); 4739241fe2SDarkWyrm } 4839241fe2SDarkWyrm return cmd; 4939241fe2SDarkWyrm } 5039241fe2SDarkWyrm transformer(const Transformer & tr)5139241fe2SDarkWyrm void transformer(const Transformer& tr) 5239241fe2SDarkWyrm { 5339241fe2SDarkWyrm m_trans = &tr; 5439241fe2SDarkWyrm } 5539241fe2SDarkWyrm 5639241fe2SDarkWyrm private: 5739241fe2SDarkWyrm conv_transform(const conv_transform<VertexSource>&); 5839241fe2SDarkWyrm const conv_transform<VertexSource>& 5939241fe2SDarkWyrm operator = (const conv_transform<VertexSource>&); 6039241fe2SDarkWyrm 6139241fe2SDarkWyrm VertexSource* m_source; 6239241fe2SDarkWyrm const Transformer* m_trans; 6339241fe2SDarkWyrm }; 6439241fe2SDarkWyrm 6539241fe2SDarkWyrm 6639241fe2SDarkWyrm } 6739241fe2SDarkWyrm 6839241fe2SDarkWyrm #endif 69