1 
2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 //
6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
10 //
11 //----------------------------------------------------------------------------
12 // Contact: mcseem@antigrain.com
13 //          mcseemagg@yahoo.com
14 //          http://www.antigrain.com
15 //----------------------------------------------------------------------------
16 #ifndef AGG_VCGEN_STROKE_INCLUDED
17 #define AGG_VCGEN_STROKE_INCLUDED
18 #include "agg_math_stroke.h"
19 namespace agg
20 {
21 class vcgen_stroke
22 {
23     enum status_e {
24         initial,
25         ready,
26         cap1,
27         cap2,
28         outline1,
29         close_first,
30         outline2,
31         out_vertices,
32         end_poly1,
33         end_poly2,
34         stop
35     };
36 public:
37     typedef vertex_sequence<vertex_dist_cmd, 6> vertex_storage;
38     typedef pod_deque<point_type, 6>        coord_storage;
39     vcgen_stroke();
line_cap(line_cap_e lc)40     void line_cap(line_cap_e lc)
41     {
42         m_line_cap = lc;
43     }
line_join(line_join_e lj)44     void line_join(line_join_e lj)
45     {
46         m_line_join = lj;
47     }
inner_join(inner_join_e ij)48     void inner_join(inner_join_e ij)
49     {
50         m_inner_join = ij;
51     }
line_cap()52     line_cap_e   line_cap()   const
53     {
54         return m_line_cap;
55     }
line_join()56     line_join_e  line_join()  const
57     {
58         return m_line_join;
59     }
inner_join()60     inner_join_e inner_join() const
61     {
62         return m_inner_join;
63     }
width(FX_FLOAT w)64     void width(FX_FLOAT w)
65     {
66         m_width = w / 2;
67     }
miter_limit(FX_FLOAT ml)68     void miter_limit(FX_FLOAT ml)
69     {
70         m_miter_limit = ml;
71     }
72     void miter_limit_theta(FX_FLOAT t);
inner_miter_limit(FX_FLOAT ml)73     void inner_miter_limit(FX_FLOAT ml)
74     {
75         m_inner_miter_limit = ml;
76     }
approximation_scale(FX_FLOAT as)77     void approximation_scale(FX_FLOAT as)
78     {
79         m_approx_scale = as;
80     }
width()81     FX_FLOAT width() const
82     {
83         return m_width * 2;
84     }
miter_limit()85     FX_FLOAT miter_limit() const
86     {
87         return m_miter_limit;
88     }
inner_miter_limit()89     FX_FLOAT inner_miter_limit() const
90     {
91         return m_inner_miter_limit;
92     }
approximation_scale()93     FX_FLOAT approximation_scale() const
94     {
95         return m_approx_scale;
96     }
97     void remove_all();
98     void add_vertex(FX_FLOAT x, FX_FLOAT y, unsigned cmd);
99     void     rewind(unsigned path_id);
100     unsigned vertex(FX_FLOAT* x, FX_FLOAT* y);
101 private:
102     vcgen_stroke(const vcgen_stroke&);
103     const vcgen_stroke& operator = (const vcgen_stroke&);
104     vertex_storage m_src_vertices;
105     coord_storage  m_out_vertices;
106     FX_FLOAT         m_width;
107     FX_FLOAT         m_miter_limit;
108     FX_FLOAT         m_inner_miter_limit;
109     FX_FLOAT         m_approx_scale;
110     line_cap_e     m_line_cap;
111     line_join_e    m_line_join;
112     inner_join_e   m_inner_join;
113     unsigned       m_closed;
114     status_e       m_status;
115     status_e       m_prev_status;
116     unsigned       m_src_vertex;
117     unsigned       m_out_vertex;
118 };
119 }
120 #endif
121