public void add_path(IVertexSource vs, int pathID) { #if false if (m_outline.sorted()) { reset(); } foreach (VertexData vertexData in vs.Vertices()) { if (!ShapePath.is_stop(vertexData.command)) { AddVertex(new VertexData(vertexData.command, new Vector2(vertexData.position.x, vertexData.position.y))); } } #else double x = 0; double y = 0; ShapePath.FlagsAndCommand PathAndFlags; vs.rewind(pathID); if (m_outline.sorted()) { reset(); } while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y))) { AddVertex(new VertexData(PathAndFlags, new Vector2(x, y))); } #endif }
public ShapePath.FlagsAndCommand vertex(out double x, out double y) { ShapePath.FlagsAndCommand cmd = VertexSource.vertex(out x, out y); if (ShapePath.is_vertex(cmd)) { ApplayYWarp(ref x, ref y); } return(cmd); }
public static bool get_bounding_rect(PathStorage vs, int[] gi, int start, int num, out double x1, out double y1, out double x2, out double y2) { int i; double x = 0; double y = 0; bool first = true; x1 = 1; y1 = 1; x2 = 0; y2 = 0; for (i = 0; i < num; i++) { vs.rewind(gi[start + i]); ShapePath.FlagsAndCommand PathAndFlags; while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y))) { if (ShapePath.is_vertex(PathAndFlags)) { if (first) { x1 = x; y1 = y; x2 = x; y2 = y; first = false; } else { if (x < x1) { x1 = x; } if (y < y1) { y1 = y; } if (x > x2) { x2 = x; } if (y > y2) { y2 = y; } } } } } return(x1 <= x2 && y1 <= y2); }
public IEnumerable <VertexData> Vertices() { foreach (VertexData vertexData in VertexSource.Vertices()) { VertexData transformedVertex = vertexData; if (ShapePath.is_vertex(transformedVertex.command)) { ApplayYWarp(ref transformedVertex.position.x, ref transformedVertex.position.y); } yield return(transformedVertex); } }
//-----------------------------------------------------bounding_rect_single //template<class VertexSource, class CoordT> public static bool bounding_rect_single(IVertexSource vs, int path_id, out double x1, out double y1, out double x2, out double y2) { double x = 0; double y = 0; bool first = true; x1 = 1; y1 = 1; x2 = 0; y2 = 0; vs.rewind(path_id); ShapePath.FlagsAndCommand PathAndFlags; while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y))) { if (ShapePath.is_vertex(PathAndFlags)) { if (first) { x1 = x; y1 = y; x2 = x; y2 = y; first = false; } else { if (x < x1) { x1 = x; } if (y < y1) { y1 = y; } if (x > x2) { x2 = x; } if (y > y2) { y2 = y; } } } } return(x1 <= x2 && y1 <= y2); }
public void add_path(IVertexSource vs, int path_id) { double x; double y; ShapePath.FlagsAndCommand cmd; vs.rewind(path_id); if (m_Rasterizer.sorted()) { reset(); } while (!ShapePath.is_stop(cmd = vs.vertex(out x, out y))) { add_vertex(x, y, cmd); } }
void add_vertex(double x, double y, ShapePath.FlagsAndCommand cmd) { if (ShapePath.is_move_to(cmd)) { move_to_d(x, y); } else if (ShapePath.is_vertex(cmd)) { line_to_d(x, y); } else if (ShapePath.is_close(cmd)) { m_VectorClipper.line_to(m_Rasterizer, m_start_x, m_start_y); } }
//------------------------------------------------------------------- public void add_path(IVertexSource vs) { double x = 0; double y = 0; ShapePath.FlagsAndCommand PathAndFlags; vs.rewind(0); if (m_outline.sorted()) { reset(); } while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y))) { AddVertex(new VertexData(PathAndFlags, new Vector2(x, y))); } }
private conv_poly_counter(IVertexSource src) { m_contours = 0; m_points = 0; foreach (VertexData vertexData in src.Vertices()) { if (ShapePath.is_vertex(vertexData.command)) { ++m_points; } if (ShapePath.is_move_to(vertexData.command)) { ++m_contours; } } }
public void add_path(IVertexSource vs, int path_id) { double x; double y; ShapePath.FlagsAndCommand cmd; vs.rewind(path_id); //int index = 0; //int start = 851; //int num = 5; while (!ShapePath.is_stop(cmd = vs.vertex(out x, out y))) { //index++; //if (index == 0 // || (index > start && index < start + num)) add_vertex(x, y, cmd); } render(false); }
private void AddVertex(VertexData vertexData) { if (ShapePath.is_move_to(vertexData.command)) { move_to_d(vertexData.position.X, vertexData.position.Y); } else { if (ShapePath.is_vertex(vertexData.command)) { line_to_d(vertexData.position.X, vertexData.position.Y); } else { if (ShapePath.is_close(vertexData.command)) { close_polygon(); } } } }
public void add_vertex(double x, double y, ShapePath.FlagsAndCommand cmd) { if (ShapePath.is_move_to(cmd)) { render(false); move_to_d(x, y); } else { if (ShapePath.is_end_poly(cmd)) { render(ShapePath.is_closed(cmd)); if (ShapePath.is_closed(cmd)) { move_to(m_start_x, m_start_y); } } else { line_to_d(x, y); } } }
void add_vertex(double x, double y, ShapePath.FlagsAndCommand cmd) { if(ShapePath.is_move_to(cmd)) { move_to_d(x, y); } else if(ShapePath.is_vertex(cmd)) { line_to_d(x, y); } else if(ShapePath.is_close(cmd)) { m_VectorClipper.line_to(m_Rasterizer, m_start_x, m_start_y); } }