Anti-Grain Geometry - AGG (libagg)  2.5
agg-2.5/include/agg_vcgen_stroke.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_STROKE_INCLUDED
00026 #define AGG_VCGEN_STROKE_INCLUDED
00027 
00028 #include "agg_math_stroke.h"
00029 
00030 
00031 namespace agg
00032 {
00033 
00034     //============================================================vcgen_stroke
00035     //
00036     // See Implementation agg_vcgen_stroke.cpp
00037     // Stroke generator
00038     //
00039     //------------------------------------------------------------------------
00040     class vcgen_stroke
00041     {
00042         enum status_e
00043         {
00044             initial,
00045             ready,
00046             cap1,
00047             cap2,
00048             outline1,
00049             close_first,
00050             outline2,
00051             out_vertices,
00052             end_poly1,
00053             end_poly2,
00054             stop
00055         };
00056 
00057     public:
00058         typedef vertex_sequence<vertex_dist, 6> vertex_storage;
00059         typedef pod_bvector<point_d, 6>         coord_storage;
00060 
00061         vcgen_stroke();
00062 
00063         void line_cap(line_cap_e lc)     { m_stroker.line_cap(lc); }
00064         void line_join(line_join_e lj)   { m_stroker.line_join(lj); }
00065         void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); }
00066 
00067         line_cap_e   line_cap()   const { return m_stroker.line_cap(); }
00068         line_join_e  line_join()  const { return m_stroker.line_join(); }
00069         inner_join_e inner_join() const { return m_stroker.inner_join(); }
00070 
00071         void width(double w) { m_stroker.width(w); }
00072         void miter_limit(double ml) { m_stroker.miter_limit(ml); }
00073         void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); }
00074         void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); }
00075         void approximation_scale(double as) { m_stroker.approximation_scale(as); }
00076 
00077         double width() const { return m_stroker.width(); }
00078         double miter_limit() const { return m_stroker.miter_limit(); }
00079         double inner_miter_limit() const { return m_stroker.inner_miter_limit(); }
00080         double approximation_scale() const { return m_stroker.approximation_scale(); }
00081 
00082         void shorten(double s) { m_shorten = s; }
00083         double shorten() const { return m_shorten; }
00084 
00085         // Vertex Generator Interface
00086         void remove_all();
00087         void add_vertex(double x, double y, unsigned cmd);
00088 
00089         // Vertex Source Interface
00090         void     rewind(unsigned path_id);
00091         unsigned vertex(double* x, double* y);
00092 
00093     private:
00094         vcgen_stroke(const vcgen_stroke&);
00095         const vcgen_stroke& operator = (const vcgen_stroke&);
00096 
00097         math_stroke<coord_storage> m_stroker;
00098         vertex_storage             m_src_vertices;
00099         coord_storage              m_out_vertices;
00100         double                     m_shorten;
00101         unsigned                   m_closed;
00102         status_e                   m_status;
00103         status_e                   m_prev_status;
00104         unsigned                   m_src_vertex;
00105         unsigned                   m_out_vertex;
00106     };
00107 
00108 
00109 }
00110 
00111 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines