/// <summary> /// Draws the given polygon. /// </summary> /// <param name="polygon">The polygon to render.</param> /// <param name="color">The color to use when drawing the polygon.</param> /// <param name="dashed">If true, the polygon will be "dashed".</param> public void AddPolygon(VectorPolygon polygon, Color color, bool dashed) { if (polygon == null) return; int step = (dashed == true) ? 2 : 1; int length = polygon.Points.Length + ((polygon.IsClosed) ? 0 : -1); for (int i = 0; i < length; i += step) { if (lineCount >= _maxPrimitives) throw new Exception("Raster graphics count has exceeded limit."); vertices[currentIndex].Position = polygon.Points[i % polygon.Points.Length]; vertices[currentIndex++].Color = color; vertices[currentIndex].Position = polygon.Points[(i + 1) % polygon.Points.Length]; vertices[currentIndex++].Color = color; lineCount++; } }
/// <summary> /// Draws the given polygon. /// </summary> /// <param name="polygon">The polygon to render.</param> /// <param name="color">The color to use when drawing the polygon.</param> public void AddPolygon(VectorPolygon polygon, Color color) { AddPolygon(polygon, color, false); }