LilyPath/DrawBatch.cs
/// <summary>
/// Adds a series of primitive Bezier paths to the batch of figures to be rendered.
/// </summary>
/// <param name="pen">The pen supplying the color to render the path with.</param>
/// <param name="points">A list of Bezier points.</param>
/// <param name="offset">The index of the first start point in the list.</param>
/// <param name="count">The number of points to use.</param>
/// <param name="bezierType">The type of Bezier curves to draw.</param>
/// <param name="pathType">Whether the path is open or closed.</param>
/// <remarks><para>For quadratic Bezier curves, the number of points defined by the parameters should be a multiple of 2 plus 1
/// for open curves or 2 for closed curves.  For cubic Bezier curves, the number of points defined by the parameters should be 
/// a multiple of 3 plus 1 for open curves or 3 for closed curves.  For each curve drawn after the first, the ending point of 
/// the previous curve is used as the starting point.  For closed curves, the end point of the last curve is the start point
/// of the first curve.</para></remarks>
/// <exception cref="InvalidOperationException"><c>DrawPrimitiveBeziers</c> was called, but <see cref="Begin()"/> has not yet been called.</exception>
Adds a series of primitive Bezier paths to the batch of figures to be rendered.
Adds a series of primitive Bezier paths to the batch of figures to be rendered .
public void DrawPrimitiveBeziers (Pen pen, IList<Vector2> points, int offset, int count, BezierType bezierType, PathType pathType)
        {
            if (!_inDraw)
                throw new InvalidOperationException();
            if (pen == null)
                throw new ArgumentNullException("pen");
            if (points.Count < offset + count)
                throw new ArgumentOutOfRangeException("The offset and count are out of range for the given points argument.");
            _pathBuilder.Reset();
            _pathBuilder.CalculateLengths = pen.NeedsPathLength;
            switch (bezierType) {
                case BezierType.Quadratic:
                    for (int i = offset + 2; i < offset + count; i += 2)
                        _pathBuilder.AddBezier(points[i - 2], points[i - 1], points[i]);
                    if (pathType == PathType.Closed)
                        _pathBuilder.AddBezier(points[offset + count - 2], points[offset + count - 1], points[offset]);
                    break;
                case BezierType.Cubic:
                    for (int i = offset + 3; i < offset + count; i += 3)
                        _pathBuilder.AddBezier(points[i - 3], points[i - 2], points[i - 1], points[i]);
                    if (pathType == PathType.Closed)
                        _pathBuilder.AddBezier(points[offset + count - 3], points[offset + count - 2], points[offset + count - 1], points[offset]);
                    break;
            }
            switch (pathType) {
                case PathType.Open:
                    DrawPrimitivePath(pen, _pathBuilder.Buffer, 0, _pathBuilder.Count, PathType.Open);
                    break;
                case PathType.Closed:
                    DrawPrimitivePath(pen, _pathBuilder.Buffer, 0, _pathBuilder.Count - 1, PathType.Closed);
                    break;
            }
            if (_sortMode == DrawSortMode.Immediate)
                FlushBuffer();
        }
public void DrawPrimitiveBeziers ( Pen pen , IList < Vector2 > points , int offset , int count , BezierType bezierType , PathType pathType ) { if ( ! _inDraw ) throw new InvalidOperationException ( ) ; if ( pen == null ) throw new ArgumentNullException ( " " ) ; if ( points . Count < offset + count ) throw new ArgumentOutOfRangeException ( " " ) ; _pathBuilder . Reset ( ) ; _pathBuilder . CalculateLengths = pen . NeedsPathLength ; switch ( bezierType ) { case BezierType . Quadratic : for ( int i = offset + 2 ; i < offset + count ; i += 2 ) _pathBuilder . AddBezier ( points [ i - 2 ] , points [ i - 1 ] , points [ i ] ) ; if ( pathType == PathType . Closed ) _pathBuilder . AddBezier ( points [ offset + count - 2 ] , points [ offset + count - 1 ] , points [ offset ] ) ; break ; case BezierType . Cubic : for ( int i = offset + 3 ; i < offset + count ; i += 3 ) _pathBuilder . AddBezier ( points [ i - 3 ] , points [ i - 2 ] , points [ i - 1 ] , points [ i ] ) ; if ( pathType == PathType . Closed ) _pathBuilder . AddBezier ( points [ offset + count - 3 ] , points [ offset + count - 2 ] , points [ offset + count - 1 ] , points [ offset ] ) ; break ; } switch ( pathType ) { case PathType . Open : DrawPrimitivePath ( pen , _pathBuilder . Buffer , 0 , _pathBuilder . Count , PathType . Open ) ; break ; case PathType . Closed : DrawPrimitivePath ( pen , _pathBuilder . Buffer , 0 , _pathBuilder . Count - 1 , PathType . Closed ) ; break ; } if ( _sortMode == DrawSortMode . Immediate ) FlushBuffer ( ) ; }
Adds a series of primitive Bezier paths to the batch of figures to be rendered.
Adds a series of primitive Bezier paths to the batch of figures to be rendered .
DrawPrimitiveBeziers has not yet been called.
DrawPrimitiveBeziers has not yet been called .
pen
Pen
The pen supplying the color to render the path with.
The pen supplying the color to render the path with .
points
IList<Vector2>
A list of Bezier points.
A list of Bezier points .
offset
int
The index of the first start point in the list.
The index of the first start point in the list .
count
int
The number of points to use.
The number of points to use .
bezierType
BezierType
The type of Bezier curves to draw.
The type of Bezier curves to draw .
pathType
PathType
Whether the path is open or closed.
Whether the path is open or closed .
remarks
For quadratic Bezier curves, the number of points defined by the parameters should be a multiple of 2 plus 1
for open curves or 2 for closed curves.  For cubic Bezier curves, the number of points defined by the parameters should be
a multiple of 3 plus 1 for open curves or 3 for closed curves.  For each curve drawn after the first, the ending point of
the previous curve is used as the starting point.  For closed curves, the end point of the last curve is the start point
of the first curve.
For quadratic Bezier curves the number of points defined by the parameters should be a multiple of 2 plus 1 for open curves or 2 for closed curves . For cubic Bezier curves the number of points defined by the parameters should be a multiple of 3 plus 1 for open curves or 3 for closed curves . For each curve drawn after the first the ending point of the previous curve is used as the starting point . For closed curves the end point of the last curve is the start point of the first curve .