1 //---------------------------------------------------------------------------- 2 // Anti-Grain Geometry - Version 2.4 3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 // 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. 9 // 10 //---------------------------------------------------------------------------- 11 // Contact: mcseem@antigrain.com 12 // mcseemagg@yahoo.com 13 // http://www.antigrain.com 14 //---------------------------------------------------------------------------- 15 // 16 // Smooth polygon generator 17 // 18 //---------------------------------------------------------------------------- 19 #ifndef AGG_CONV_SMOOTH_POLY1_INCLUDED 20 #define AGG_CONV_SMOOTH_POLY1_INCLUDED 21 22 #include "agg_basics.h" 23 #include "agg_vcgen_smooth_poly1.h" 24 #include "agg_conv_adaptor_vcgen.h" 25 #include "agg_conv_curve.h" 26 27 28 namespace agg 29 { 30 31 //-------------------------------------------------------conv_smooth_poly1 32 template<class VertexSource> 33 struct conv_smooth_poly1 : 34 public conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1> 35 { 36 typedef conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1> base_type; 37 conv_smooth_poly1conv_smooth_poly138 conv_smooth_poly1(VertexSource& vs) : 39 conv_adaptor_vcgen<VertexSource, vcgen_smooth_poly1>(vs) 40 { 41 } 42 smooth_valueconv_smooth_poly143 void smooth_value(double v) { base_type::generator().smooth_value(v); } smooth_valueconv_smooth_poly144 double smooth_value() const { return base_type::generator().smooth_value(); } 45 46 private: 47 conv_smooth_poly1(const conv_smooth_poly1<VertexSource>&); 48 const conv_smooth_poly1<VertexSource>& 49 operator = (const conv_smooth_poly1<VertexSource>&); 50 }; 51 52 53 54 //-------------------------------------------------conv_smooth_poly1_curve 55 template<class VertexSource> 56 struct conv_smooth_poly1_curve : 57 public conv_curve<conv_smooth_poly1<VertexSource> > 58 { conv_smooth_poly1_curveconv_smooth_poly1_curve59 conv_smooth_poly1_curve(VertexSource& vs) : 60 conv_curve<conv_smooth_poly1<VertexSource> >(m_smooth), 61 m_smooth(vs) 62 { 63 } 64 smooth_valueconv_smooth_poly1_curve65 void smooth_value(double v) { m_smooth.generator().smooth_value(v); } smooth_valueconv_smooth_poly1_curve66 double smooth_value() const { return m_smooth.generator().smooth_value(); } 67 68 private: 69 conv_smooth_poly1_curve(const conv_smooth_poly1_curve<VertexSource>&); 70 const conv_smooth_poly1_curve<VertexSource>& 71 operator = (const conv_smooth_poly1_curve<VertexSource>&); 72 73 conv_smooth_poly1<VertexSource> m_smooth; 74 }; 75 76 } 77 78 79 #endif 80 81