1 //---------------------------------------------------------------------------- 2 // Anti-Grain Geometry (AGG) - Version 2.5 3 // A high quality rendering engine for C++ 4 // Copyright (C) 2002-2006 Maxim Shemanarev 5 // Contact: mcseem@antigrain.com 6 // mcseemagg@yahoo.com 7 // http://antigrain.com 8 // 9 // AGG is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // AGG is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with AGG; if not, write to the Free Software 21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 // MA 02110-1301, USA. 23 //---------------------------------------------------------------------------- 24 25 #ifndef AGG_VCGEN_STROKE_INCLUDED 26 #define AGG_VCGEN_STROKE_INCLUDED 27 28 #include "agg_math_stroke.h" 29 30 31 namespace agg 32 { 33 34 //============================================================vcgen_stroke 35 // 36 // See Implementation agg_vcgen_stroke.cpp 37 // Stroke generator 38 // 39 //------------------------------------------------------------------------ 40 class vcgen_stroke 41 { 42 enum status_e 43 { 44 initial, 45 ready, 46 cap1, 47 cap2, 48 outline1, 49 close_first, 50 outline2, 51 out_vertices, 52 end_poly1, 53 end_poly2, 54 stop 55 }; 56 57 public: 58 typedef vertex_sequence<vertex_dist, 6> vertex_storage; 59 typedef pod_bvector<point_d, 6> coord_storage; 60 61 vcgen_stroke(); 62 line_cap(line_cap_e lc)63 void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } line_join(line_join_e lj)64 void line_join(line_join_e lj) { m_stroker.line_join(lj); } inner_join(inner_join_e ij)65 void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } 66 line_cap()67 line_cap_e line_cap() const { return m_stroker.line_cap(); } line_join()68 line_join_e line_join() const { return m_stroker.line_join(); } inner_join()69 inner_join_e inner_join() const { return m_stroker.inner_join(); } 70 width(double w)71 void width(double w) { m_stroker.width(w); } miter_limit(double ml)72 void miter_limit(double ml) { m_stroker.miter_limit(ml); } miter_limit_theta(double t)73 void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } inner_miter_limit(double ml)74 void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } approximation_scale(double as)75 void approximation_scale(double as) { m_stroker.approximation_scale(as); } 76 width()77 double width() const { return m_stroker.width(); } miter_limit()78 double miter_limit() const { return m_stroker.miter_limit(); } inner_miter_limit()79 double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } approximation_scale()80 double approximation_scale() const { return m_stroker.approximation_scale(); } 81 shorten(double s)82 void shorten(double s) { m_shorten = s; } shorten()83 double shorten() const { return m_shorten; } 84 85 // Vertex Generator Interface 86 void remove_all(); 87 void add_vertex(double x, double y, unsigned cmd); 88 89 // Vertex Source Interface 90 void rewind(unsigned path_id); 91 unsigned vertex(double* x, double* y); 92 93 private: 94 vcgen_stroke(const vcgen_stroke&); 95 const vcgen_stroke& operator = (const vcgen_stroke&); 96 97 math_stroke<coord_storage> m_stroker; 98 vertex_storage m_src_vertices; 99 coord_storage m_out_vertices; 100 double m_shorten; 101 unsigned m_closed; 102 status_e m_status; 103 status_e m_prev_status; 104 unsigned m_src_vertex; 105 unsigned m_out_vertex; 106 }; 107 108 109 } 110 111 #endif 112