Debian Codegraph @

extern/agg24-svn/include/agg_vcgen_contour.h

raw
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: [email protected]
12 // [email protected]
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
46 void line_cap(line_cap_e lc) { m_stroker.line_cap(lc); }
47 void line_join(line_join_e lj) { m_stroker.line_join(lj); }
48 void inner_join(inner_join_e ij) { m_stroker.inner_join(ij); }
49
50 line_cap_e line_cap() const { return m_stroker.line_cap(); }
51 line_join_e line_join() const { return m_stroker.line_join(); }
52 inner_join_e inner_join() const { return m_stroker.inner_join(); }
53
54 void width(double w) { m_stroker.width(m_width = w); }
55 void miter_limit(double ml) { m_stroker.miter_limit(ml); }
56 void miter_limit_theta(double t) { m_stroker.miter_limit_theta(t); }
57 void inner_miter_limit(double ml) { m_stroker.inner_miter_limit(ml); }
58 void approximation_scale(double as) { m_stroker.approximation_scale(as); }
59
60 double width() const { return m_width; }
61 double miter_limit() const { return m_stroker.miter_limit(); }
62 double inner_miter_limit() const { return m_stroker.inner_miter_limit(); }
63 double approximation_scale() const { return m_stroker.approximation_scale(); }
64
65 void auto_detect_orientation(bool v) { m_auto_detect = v; }
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