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 #ifndef AGG_VCGEN_CONTOUR_INCLUDED 17 #define AGG_VCGEN_CONTOUR_INCLUDED 18 19 #include "agg_math_stroke.h" 20 21 namespace agg 22 { 23 24 //----------------------------------------------------------vcgen_contour 25 // 26 // See Implementation agg_vcgen_contour.cpp 27 // 28 class vcgen_contour 29 { 30 enum status_e 31 { 32 initial, 33 ready, 34 outline, 35 out_vertices, 36 end_poly, 37 stop 38 }; 39 40 public: 41 typedef vertex_sequence<vertex_dist, 6> vertex_storage; 42 typedef pod_bvector<point_d, 6> coord_storage; 43 44 vcgen_contour(); 45 line_cap(line_cap_e lc)46 void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); } line_join(line_join_e lj)47 void line_join(line_join_e lj) { m_stroker.line_join(lj); } inner_join(inner_join_e ij)48 void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); } 49 line_cap()50 line_cap_e line_cap() const { return m_stroker.line_cap(); } line_join()51 line_join_e line_join() const { return m_stroker.line_join(); } inner_join()52 inner_join_e inner_join() const { return m_stroker.inner_join(); } 53 width(double w)54 void width(double w) { m_stroker.width(m_width = w); } miter_limit(double ml)55 void miter_limit(double ml) { m_stroker.miter_limit(ml); } miter_limit_theta(double t)56 void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); } inner_miter_limit(double ml)57 void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); } approximation_scale(double as)58 void approximation_scale(double as) { m_stroker.approximation_scale(as); } 59 width()60 double width() const { return m_width; } miter_limit()61 double miter_limit() const { return m_stroker.miter_limit(); } inner_miter_limit()62 double inner_miter_limit() const { return m_stroker.inner_miter_limit(); } approximation_scale()63 double approximation_scale() const { return m_stroker.approximation_scale(); } 64 auto_detect_orientation(bool v)65 void auto_detect_orientation(bool v) { m_auto_detect = v; } auto_detect_orientation()66 bool auto_detect_orientation() const { return m_auto_detect; } 67 68 // Generator interface 69 void remove_all(); 70 void add_vertex(double x, double y, unsigned cmd); 71 72 // Vertex Source Interface 73 void rewind(unsigned path_id); 74 unsigned vertex(double* x, double* y); 75 76 private: 77 vcgen_contour(const vcgen_contour&); 78 const vcgen_contour& operator = (const vcgen_contour&); 79 80 math_stroke<coord_storage> m_stroker; 81 double m_width; 82 vertex_storage m_src_vertices; 83 coord_storage m_out_vertices; 84 status_e m_status; 85 unsigned m_src_vertex; 86 unsigned m_out_vertex; 87 unsigned m_closed; 88 unsigned m_orientation; 89 bool m_auto_detect; 90 }; 91 92 } 93 94 #endif 95