20 #ifndef AGG_CONV_CURVE_INCLUDED 21 #define AGG_CONV_CURVE_INCLUDED 23 #include "agg_basics.h" 24 #include "agg_curves.h" 54 template<
class VertexSource,
59 typedef Curve3 curve3_type;
60 typedef Curve4 curve4_type;
64 m_source(&source), m_last_x(0.0), m_last_y(0.0) {}
65 void attach(VertexSource& source) { m_source = &source; }
67 void approximation_method(curve_approximation_method_e v)
69 m_curve3.approximation_method(v);
70 m_curve4.approximation_method(v);
73 curve_approximation_method_e approximation_method()
const 75 return m_curve4.approximation_method();
78 void approximation_scale(
double s)
80 m_curve3.approximation_scale(s);
81 m_curve4.approximation_scale(s);
84 double approximation_scale()
const 86 return m_curve4.approximation_scale();
89 void angle_tolerance(
double v)
91 m_curve3.angle_tolerance(v);
92 m_curve4.angle_tolerance(v);
95 double angle_tolerance()
const 97 return m_curve4.angle_tolerance();
100 void cusp_limit(
double v)
102 m_curve3.cusp_limit(v);
103 m_curve4.cusp_limit(v);
106 double cusp_limit()
const 108 return m_curve4.cusp_limit();
111 void rewind(
unsigned path_id);
112 unsigned vertex(
double* x,
double* y);
116 const self_type& operator = (
const self_type&);
118 VertexSource* m_source;
121 curve3_type m_curve3;
122 curve4_type m_curve4;
128 template<
class VertexSource,
class Curve3,
class Curve4>
131 m_source->rewind(path_id);
140 template<
class VertexSource,
class Curve3,
class Curve4>
143 if(!is_stop(m_curve3.vertex(x, y)))
147 return path_cmd_line_to;
150 if(!is_stop(m_curve4.vertex(x, y)))
154 return path_cmd_line_to;
162 unsigned cmd = m_source->vertex(x, y);
165 case path_cmd_curve3:
166 m_source->vertex(&end_x, &end_y);
168 m_curve3.init(m_last_x, m_last_y,
172 m_curve3.vertex(x, y);
173 m_curve3.vertex(x, y);
174 cmd = path_cmd_line_to;
177 case path_cmd_curve4:
178 m_source->vertex(&ct2_x, &ct2_y);
179 m_source->vertex(&end_x, &end_y);
181 m_curve4.init(m_last_x, m_last_y,
186 m_curve4.vertex(x, y);
187 m_curve4.vertex(x, y);
188 cmd = path_cmd_line_to;