Ejemplo n.º 1
0
 /// <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 DrawPolygon(VectorPolygon polygon, Color color, bool dashed)
 {
     if (polygon == null)
     {
         throw new ArgumentNullException("polygon");
     }
     int step = (dashed == true) ? 2 : 1;
     for (int i = 0; i < polygon.TransformedPoints.Length; i += step)
     {
         if (currentIndex >= vertices.Length - 2)
         {
             End();
             Begin();
         }
         vertices[currentIndex].Position.X = 
             polygon.TransformedPoints[i % polygon.TransformedPoints.Length].X;
         vertices[currentIndex].Position.Y = 
             polygon.TransformedPoints[i % polygon.TransformedPoints.Length].Y;
         vertices[currentIndex++].Color = color;
         vertices[currentIndex].Position.X = 
             polygon.TransformedPoints[(i + 1) % 
                 polygon.TransformedPoints.Length].X;
         vertices[currentIndex].Position.Y =
             polygon.TransformedPoints[(i + 1) % 
                 polygon.TransformedPoints.Length].Y;
         vertices[currentIndex++].Color = color;
         lineCount++;
     }
 }
Ejemplo n.º 2
0
 /// <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 DrawPolygon(VectorPolygon polygon, Color color)
 {
     DrawPolygon(polygon, color, false);
 }