LilyPath/DrawBatch.cs
/// <summary>
/// Adds a primitive multisegment path to the batch of figures to be rendered.
/// </summary>
/// <param name="pen">The pen supplying a color to render the path with.</param>
/// <param name="points">The list of points that make up the path to be rendered.</param>
/// <param name="offset">The offset into the <paramref name="points"/> list to begin rendering.</param>
/// <param name="count">The number of points that should be rendered, starting from <paramref name="offset"/>.</param>
/// <param name="pathType">Whether the path is open or closed.</param>
/// <exception cref="InvalidOperationException"><c>DrawPrimitivePath</c> was called, but <see cref="Begin()"/> has not yet been called.</exception>
Adds a primitive multisegment path to the batch of figures to be rendered.
Adds a primitive multisegment path to the batch of figures to be rendered .
public void DrawPrimitivePath (Pen pen, IList<Vector2> points, int offset, int count, PathType pathType)
        {
            if (!_inDraw)
                throw new InvalidOperationException();
            if (pen == null)
                throw new ArgumentNullException("pen");
            if (offset + count > points.Count)
                throw new ArgumentOutOfRangeException("points", "The offset and count exceed the bounds of the list");
            RequestBufferSpace(count, (pathType == PathType.Open) ? count * 2 - 2 : count * 2);
            AddInfo(PrimitiveType.LineList, count, (pathType == PathType.Open) ? count * 2 - 2 : count * 2, pen.Brush);
            int baseVertexIndex = _vertexBufferIndex;
            for (int i = 0; i < count; i++) {
                Vector2 pos = new Vector2(points[offset + i].X, points[offset + i].Y);
                _vertexBuffer[_vertexBufferIndex++] = new VertexPositionColorTexture(new Vector3(pos, 0), pen.Color, Vector2.Zero);
            }
            for (int i = 1; i < count; i++) {
                _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex + i - 1);
                _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex + i);
            }
            if (pathType == PathType.Closed) {
                _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex + count - 1);
                _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex);
            }
            if (_sortMode == DrawSortMode.Immediate)
                FlushBuffer();
        }
public void DrawPrimitivePath ( Pen pen , IList < Vector2 > points , int offset , int count , PathType pathType ) { if ( ! _inDraw ) throw new InvalidOperationException ( ) ; if ( pen == null ) throw new ArgumentNullException ( " " ) ; if ( offset + count > points . Count ) throw new ArgumentOutOfRangeException ( " " , " " ) ; RequestBufferSpace ( count , ( pathType == PathType . Open ) ? count * 2 - 2 : count * 2 ) ; AddInfo ( PrimitiveType . LineList , count , ( pathType == PathType . Open ) ? count * 2 - 2 : count * 2 , pen . Brush ) ; int baseVertexIndex = _vertexBufferIndex ; for ( int i = 0 ; i < count ; i ++ ) { Vector2 pos = new Vector2 ( points [ offset + i ] . X , points [ offset + i ] . Y ) ; _vertexBuffer [ _vertexBufferIndex ++ ] = new VertexPositionColorTexture ( new Vector3 ( pos , 0 ) , pen . Color , Vector2 . Zero ) ; } for ( int i = 1 ; i < count ; i ++ ) { _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex + i - 1 ) ; _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex + i ) ; } if ( pathType == PathType . Closed ) { _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex + count - 1 ) ; _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex ) ; } if ( _sortMode == DrawSortMode . Immediate ) FlushBuffer ( ) ; }
Adds a primitive multisegment path to the batch of figures to be rendered.
Adds a primitive multisegment path to the batch of figures to be rendered .
DrawPrimitivePath has not yet been called.
DrawPrimitivePath has not yet been called .
pen
Pen
The pen supplying a color to render the path with.
The pen supplying a color to render the path with .
points
IList<Vector2>
The list of points that make up the path to be rendered.
The list of points that make up the path to be rendered .
offset
int
The offset into the  list to begin rendering.
The offset into the list to begin rendering .
count
int
The number of points that should be rendered, starting from .
The number of points that should be rendered starting from .
pathType
PathType
Whether the path is open or closed.
Whether the path is open or closed .