Example #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)
            {
                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 >= m_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++;
            }
        }
Example #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);
 }