139241fe2SDarkWyrm //---------------------------------------------------------------------------- 239241fe2SDarkWyrm // Anti-Grain Geometry - Version 2.2 339241fe2SDarkWyrm // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com) 439241fe2SDarkWyrm // 539241fe2SDarkWyrm // Permission to copy, use, modify, sell and distribute this software 639241fe2SDarkWyrm // is granted provided this copyright notice appears in all copies. 739241fe2SDarkWyrm // This software is provided "as is" without express or implied 839241fe2SDarkWyrm // warranty, and with no claim as to its suitability for any purpose. 939241fe2SDarkWyrm // 1039241fe2SDarkWyrm //---------------------------------------------------------------------------- 1139241fe2SDarkWyrm // Contact: mcseem@antigrain.com 1239241fe2SDarkWyrm // mcseemagg@yahoo.com 1339241fe2SDarkWyrm // http://www.antigrain.com 1439241fe2SDarkWyrm //---------------------------------------------------------------------------- 1539241fe2SDarkWyrm 1639241fe2SDarkWyrm #ifndef AGG_VCGEN_CONTOUR_INCLUDED 1739241fe2SDarkWyrm #define AGG_VCGEN_CONTOUR_INCLUDED 1839241fe2SDarkWyrm 19*abd00302SDarkWyrm #include "agg_math_stroke.h" 20*abd00302SDarkWyrm #include "agg_vertex_iterator.h" 2139241fe2SDarkWyrm 2239241fe2SDarkWyrm namespace agg 2339241fe2SDarkWyrm { 2439241fe2SDarkWyrm 2539241fe2SDarkWyrm //----------------------------------------------------------vcgen_contour 2639241fe2SDarkWyrm // 2739241fe2SDarkWyrm // See Implementation agg_vcgen_contour.cpp 2839241fe2SDarkWyrm // 2939241fe2SDarkWyrm class vcgen_contour 3039241fe2SDarkWyrm { 3139241fe2SDarkWyrm enum status_e 3239241fe2SDarkWyrm { 3339241fe2SDarkWyrm initial, 3439241fe2SDarkWyrm ready, 3539241fe2SDarkWyrm outline, 36*abd00302SDarkWyrm out_vertices, 37*abd00302SDarkWyrm end_poly, 38*abd00302SDarkWyrm stop 3939241fe2SDarkWyrm }; 4039241fe2SDarkWyrm 4139241fe2SDarkWyrm public: 4239241fe2SDarkWyrm typedef vertex_sequence<vertex_dist, 6> vertex_storage; 43*abd00302SDarkWyrm typedef pod_deque<point_type, 6> coord_storage; 4439241fe2SDarkWyrm 4539241fe2SDarkWyrm vcgen_contour(); 4639241fe2SDarkWyrm 47*abd00302SDarkWyrm void line_join(line_join_e lj) { m_line_join = lj; } 48*abd00302SDarkWyrm void inner_line_join(line_join_e lj) { m_inner_line_join = lj; } 4939241fe2SDarkWyrm void width(double w) { m_width = w * 0.5; } 5039241fe2SDarkWyrm void miter_limit(double ml) { m_miter_limit = ml; } 5139241fe2SDarkWyrm void miter_limit_theta(double t); 52*abd00302SDarkWyrm void inner_miter_limit(double ml) { m_inner_miter_limit = ml; } 53*abd00302SDarkWyrm void approximation_scale(double as) { m_approx_scale = as; } 5439241fe2SDarkWyrm void auto_detect_orientation(bool v) { m_auto_detect = v; } 5539241fe2SDarkWyrm 56*abd00302SDarkWyrm line_join_e line_join() const { return m_line_join; } 57*abd00302SDarkWyrm line_join_e inner_line_join() const { return m_inner_line_join; } 5839241fe2SDarkWyrm double width() const { return m_width * 2.0; } 5939241fe2SDarkWyrm double miter_limit() const { return m_miter_limit; } 60*abd00302SDarkWyrm double inner_miter_limit() const { return m_inner_miter_limit; } 61*abd00302SDarkWyrm double approximation_scale() const { return m_approx_scale; } 6239241fe2SDarkWyrm bool auto_detect_orientation() const { return m_auto_detect; } 6339241fe2SDarkWyrm 6439241fe2SDarkWyrm // Generator interface 6539241fe2SDarkWyrm void remove_all(); 6639241fe2SDarkWyrm void add_vertex(double x, double y, unsigned cmd); 6739241fe2SDarkWyrm 6839241fe2SDarkWyrm // Vertex Source Interface 6939241fe2SDarkWyrm void rewind(unsigned id); 7039241fe2SDarkWyrm unsigned vertex(double* x, double* y); 7139241fe2SDarkWyrm 7239241fe2SDarkWyrm private: 7339241fe2SDarkWyrm vcgen_contour(const vcgen_contour&); 7439241fe2SDarkWyrm const vcgen_contour& operator = (const vcgen_contour&); 7539241fe2SDarkWyrm 7639241fe2SDarkWyrm vertex_storage m_src_vertices; 77*abd00302SDarkWyrm coord_storage m_out_vertices; 7839241fe2SDarkWyrm double m_width; 79*abd00302SDarkWyrm line_join_e m_line_join; 80*abd00302SDarkWyrm line_join_e m_inner_line_join; 81*abd00302SDarkWyrm double m_approx_scale; 8239241fe2SDarkWyrm double m_abs_width; 8339241fe2SDarkWyrm double m_signed_width; 8439241fe2SDarkWyrm double m_miter_limit; 85*abd00302SDarkWyrm double m_inner_miter_limit; 8639241fe2SDarkWyrm status_e m_status; 8739241fe2SDarkWyrm unsigned m_src_vertex; 88*abd00302SDarkWyrm unsigned m_out_vertex; 8939241fe2SDarkWyrm unsigned m_closed; 9039241fe2SDarkWyrm unsigned m_orientation; 9139241fe2SDarkWyrm bool m_auto_detect; 9239241fe2SDarkWyrm }; 9339241fe2SDarkWyrm 9439241fe2SDarkWyrm } 9539241fe2SDarkWyrm 9639241fe2SDarkWyrm #endif 97