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