public ShapePath.FlagsAndCommand Vertex(ref double x, ref double y) { ShapePath.FlagsAndCommand cmd = ShapePath.FlagsAndCommand.CommandLineTo; while (!ShapePath.is_stop(cmd)) { switch (m_status) { case StrokeMath.status_e.initial: Rewind(0); goto case StrokeMath.status_e.ready; case StrokeMath.status_e.ready: if (m_src_vertices.size() < 2 + (m_closed != 0 ? 1 : 0)) { cmd = ShapePath.FlagsAndCommand.CommandStop; break; } m_status = (m_closed != 0) ? StrokeMath.status_e.outline1 : StrokeMath.status_e.cap1; cmd = ShapePath.FlagsAndCommand.CommandMoveTo; m_src_vertex = 0; m_out_vertex = 0; break; case StrokeMath.status_e.cap1: m_stroker.calc_cap(m_out_vertices, m_src_vertices[0], m_src_vertices[1], m_src_vertices[0].dist); m_src_vertex = 1; m_prev_status = StrokeMath.status_e.outline1; m_status = StrokeMath.status_e.out_vertices; m_out_vertex = 0; break; case StrokeMath.status_e.cap2: m_stroker.calc_cap(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 = StrokeMath.status_e.outline2; m_status = StrokeMath.status_e.out_vertices; m_out_vertex = 0; break; case StrokeMath.status_e.outline1: if (m_closed != 0) { if (m_src_vertex >= m_src_vertices.size()) { m_prev_status = StrokeMath.status_e.close_first; m_status = StrokeMath.status_e.end_poly1; break; } } else { if (m_src_vertex >= m_src_vertices.size() - 1) { m_status = StrokeMath.status_e.cap2; break; } } m_stroker.calc_join(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 = StrokeMath.status_e.out_vertices; m_out_vertex = 0; break; case StrokeMath.status_e.close_first: m_status = StrokeMath.status_e.outline2; cmd = ShapePath.FlagsAndCommand.CommandMoveTo; goto case StrokeMath.status_e.outline2; case StrokeMath.status_e.outline2: if (m_src_vertex <= (m_closed == 0 ? 1 : 0)) { m_status = StrokeMath.status_e.end_poly2; m_prev_status = StrokeMath.status_e.stop; break; } --m_src_vertex; m_stroker.calc_join(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 = StrokeMath.status_e.out_vertices; m_out_vertex = 0; break; case StrokeMath.status_e.out_vertices: if (m_out_vertex >= m_out_vertices.size()) { m_status = m_prev_status; } else { Vector2 c = m_out_vertices[(int)m_out_vertex++]; x = c.x; y = c.y; return(cmd); } break; case StrokeMath.status_e.end_poly1: m_status = m_prev_status; return(ShapePath.FlagsAndCommand.CommandEndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW); case StrokeMath.status_e.end_poly2: m_status = m_prev_status; return(ShapePath.FlagsAndCommand.CommandEndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCW); case StrokeMath.status_e.stop: cmd = ShapePath.FlagsAndCommand.CommandStop; break; } } return(cmd); }
public ShapePath.FlagsAndCommand Vertex(ref double x, ref double y) { ShapePath.FlagsAndCommand cmd = ShapePath.FlagsAndCommand.LineTo; while (!ShapePath.is_stop(cmd)) { switch (m_status) { case StrokeMath.status_e.initial: Rewind(0); goto case StrokeMath.status_e.ready; case StrokeMath.status_e.ready: if (m_src_vertices.size() < 2 + (m_closed ? 1 : 0)) { cmd = ShapePath.FlagsAndCommand.Stop; break; } m_status = StrokeMath.status_e.outline1; cmd = ShapePath.FlagsAndCommand.MoveTo; m_src_vertex = 0; m_out_vertex = 0; goto case StrokeMath.status_e.outline1; case StrokeMath.status_e.outline1: if (m_src_vertex >= m_src_vertices.size()) { m_status = StrokeMath.status_e.end_poly1; break; } m_stroker.calc_join(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_status = StrokeMath.status_e.out_vertices; m_out_vertex = 0; goto case StrokeMath.status_e.out_vertices; case StrokeMath.status_e.out_vertices: if (m_out_vertex >= m_out_vertices.size()) { m_status = StrokeMath.status_e.outline1; } else { Vector2 c = m_out_vertices[m_out_vertex++]; x = c.X; y = c.Y; return(cmd); } break; case StrokeMath.status_e.end_poly1: if (!m_closed) { return(ShapePath.FlagsAndCommand.Stop); } m_status = StrokeMath.status_e.stop; return(ShapePath.FlagsAndCommand.EndPoly | ShapePath.FlagsAndCommand.FlagClose | ShapePath.FlagsAndCommand.FlagCCW); case StrokeMath.status_e.stop: return(ShapePath.FlagsAndCommand.Stop); } } return(cmd); }