Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_vcgen_smooth_poly1.h
Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 // Anti-Grain Geometry (AGG) - Version 2.5
00003 // A high quality rendering engine for C++
00004 // Copyright (C) 2002-2006 Maxim Shemanarev
00005 // Contact: mcseem@antigrain.com
00006 //          mcseemagg@yahoo.com
00007 //          http://antigrain.com
00008 // 
00009 // AGG is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 // 
00014 // AGG is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 // 
00019 // You should have received a copy of the GNU General Public License
00020 // along with AGG; if not, write to the Free Software
00021 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00022 // MA 02110-1301, USA.
00023 //----------------------------------------------------------------------------
00024 
00025 #ifndef AGG_VCGEN_SMOOTH_POLY1_INCLUDED
00026 #define AGG_VCGEN_SMOOTH_POLY1_INCLUDED
00027 
00028 #include "agg_basics.h"
00029 #include "agg_vertex_sequence.h"
00030 
00031 
00032 namespace agg
00033 {
00034 
00035     //======================================================vcgen_smooth_poly1
00036     //
00037     // See Implementation agg_vcgen_smooth_poly1.cpp 
00038     // Smooth polygon generator
00039     //
00040     //------------------------------------------------------------------------
00041     class vcgen_smooth_poly1
00042     {
00043         enum status_e
00044         {
00045             initial,
00046             ready,
00047             polygon,
00048             ctrl_b,
00049             ctrl_e,
00050             ctrl1,
00051             ctrl2,
00052             end_poly,
00053             stop
00054         };
00055 
00056     public:
00057         typedef vertex_sequence<vertex_dist, 6> vertex_storage;
00058 
00059         vcgen_smooth_poly1();
00060 
00061         void   smooth_value(double v) { m_smooth_value = v * 0.5; }
00062         double smooth_value() const { return m_smooth_value * 2.0; }
00063 
00064         // Vertex Generator Interface
00065         void remove_all();
00066         void add_vertex(double x, double y, unsigned cmd);
00067 
00068         // Vertex Source Interface
00069         void     rewind(unsigned path_id);
00070         unsigned vertex(double* x, double* y);
00071 
00072     private:
00073         vcgen_smooth_poly1(const vcgen_smooth_poly1&);
00074         const vcgen_smooth_poly1& operator = (const vcgen_smooth_poly1&);
00075 
00076         void calculate(const vertex_dist& v0, 
00077                        const vertex_dist& v1, 
00078                        const vertex_dist& v2,
00079                        const vertex_dist& v3);
00080 
00081         vertex_storage m_src_vertices;
00082         double         m_smooth_value;
00083         unsigned       m_closed;
00084         status_e       m_status;
00085         unsigned       m_src_vertex;
00086         double         m_ctrl1_x;
00087         double         m_ctrl1_y;
00088         double         m_ctrl2_x;
00089         double         m_ctrl2_y;
00090     };
00091 
00092 }
00093 
00094 
00095 #endif
00096 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines