// Vertex Generator Interface public void RemoveAll() { m_src_vertices.RemoveAll(); m_closed = 0; m_status = status_e.initial; }
public uint Vertex(ref double x, ref double y) { uint cmd = (uint)Path.EPathCommands.LineTo; while (!Path.IsStop(cmd)) { switch (m_status) { case status_e.initial: Rewind(0); goto case status_e.ready; case status_e.ready: if (m_src_vertices.Size() < 2 + (m_closed != 0 ? 1 : 0)) { cmd = (uint)Path.EPathCommands.Stop; break; } m_status = (m_closed != 0) ? VcGenStroke.status_e.outline1 : VcGenStroke.status_e.cap1; cmd = (uint)Path.EPathCommands.MoveTo; m_src_vertex = 0; m_out_vertex = 0; break; case status_e.cap1: m_stroker.CaluclateCap(m_out_vertices, m_src_vertices[0], m_src_vertices[1], m_src_vertices[0].dist); m_src_vertex = 1; m_prev_status = VcGenStroke.status_e.outline1; m_status = VcGenStroke.status_e.out_vertices; m_out_vertex = 0; break; case status_e.cap2: m_stroker.CaluclateCap(m_out_vertices, m_src_vertices[m_src_vertices.Size() - 1], m_src_vertices[m_src_vertices.Size() - 2], m_src_vertices[m_src_vertices.Size() - 2].dist); m_prev_status = VcGenStroke.status_e.outline2; m_status = VcGenStroke.status_e.out_vertices; m_out_vertex = 0; break; case status_e.outline1: if (m_closed != 0) { if (m_src_vertex >= m_src_vertices.Size()) { m_prev_status = VcGenStroke.status_e.close_first; m_status = VcGenStroke.status_e.end_poly1; break; } } else { if (m_src_vertex >= m_src_vertices.Size() - 1) { m_status = VcGenStroke.status_e.cap2; break; } } m_stroker.CalculateJoin(m_out_vertices, m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.next(m_src_vertex), m_src_vertices.prev(m_src_vertex).dist, m_src_vertices.curr(m_src_vertex).dist); ++m_src_vertex; m_prev_status = m_status; m_status = VcGenStroke.status_e.out_vertices; m_out_vertex = 0; break; case status_e.close_first: m_status = VcGenStroke.status_e.outline2; cmd = (uint)Path.EPathCommands.MoveTo; goto case status_e.outline2; case status_e.outline2: if (m_src_vertex <= (m_closed == 0 ? 1 : 0)) { m_status = VcGenStroke.status_e.end_poly2; m_prev_status = VcGenStroke.status_e.stop; break; } --m_src_vertex; m_stroker.CalculateJoin(m_out_vertices, m_src_vertices.next(m_src_vertex), m_src_vertices.curr(m_src_vertex), m_src_vertices.prev(m_src_vertex), m_src_vertices.curr(m_src_vertex).dist, m_src_vertices.prev(m_src_vertex).dist); m_prev_status = m_status; m_status = VcGenStroke.status_e.out_vertices; m_out_vertex = 0; break; case status_e.out_vertices: if (m_out_vertex >= m_out_vertices.Size()) { m_status = m_prev_status; } else { PointD c = m_out_vertices[(int)m_out_vertex++]; x = c.x; y = c.y; return(cmd); } break; case status_e.end_poly1: m_status = m_prev_status; return((uint)Path.EPathCommands.EndPoly | (uint)Path.EPathFlags.Close | (uint)Path.EPathFlags.CounterClockwise); case status_e.end_poly2: m_status = m_prev_status; return((uint)Path.EPathCommands.EndPoly | (uint)Path.EPathFlags.Close | (uint)Path.EPathFlags.Clockwise); case status_e.stop: cmd = (uint)Path.EPathCommands.Stop; break; } } return(cmd); }