20 #include "agg_vcgen_contour.h" 26 vcgen_contour::vcgen_contour() :
40 void vcgen_contour::remove_all()
42 m_src_vertices.remove_all();
49 void vcgen_contour::add_vertex(
double x,
double y,
unsigned cmd)
54 m_src_vertices.modify_last(vertex_dist(x, y));
60 m_src_vertices.add(vertex_dist(x, y));
66 m_closed = get_close_flag(cmd);
67 if(m_orientation == path_flags_none)
69 m_orientation = get_orientation(cmd);
77 void vcgen_contour::rewind(
unsigned)
79 if(m_status == initial)
81 m_src_vertices.close(
true);
84 if(!is_oriented(m_orientation))
86 m_orientation = (calc_polygon_area(m_src_vertices) > 0.0) ?
91 if(is_oriented(m_orientation))
93 m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width);
101 unsigned vcgen_contour::vertex(
double* x,
double* y)
103 unsigned cmd = path_cmd_line_to;
112 if(m_src_vertices.size() < 2 + unsigned(m_closed != 0))
118 cmd = path_cmd_move_to;
123 if(m_src_vertex >= m_src_vertices.size())
128 m_stroker.calc_join(m_out_vertices,
129 m_src_vertices.prev(m_src_vertex),
130 m_src_vertices.curr(m_src_vertex),
131 m_src_vertices.next(m_src_vertex),
132 m_src_vertices.prev(m_src_vertex).dist,
133 m_src_vertices.curr(m_src_vertex).dist);
135 m_status = out_vertices;
139 if(m_out_vertex >= m_out_vertices.size())
145 const point_d& c = m_out_vertices[m_out_vertex++];
153 if(!m_closed)
return path_cmd_stop;
155 return path_cmd_end_poly | path_flags_close | path_flags_ccw;
158 return path_cmd_stop;