LilyPath/DrawBatch.cs
/// <summary>
/// Adds a filled arc to the batch of figures to be rendered using up to the given number of subdivisions.
/// </summary>
/// <param name="brush">The brush to render the shape with.</param>
/// <param name="center">The center coordinate of the arc.</param>
/// <param name="radius">The radius of the arc.</param>
/// <param name="startAngle">The starting angle of the arc in radians, where 0 is 3 O'Clock.</param>
/// <param name="arcAngle">The sweep of the arc in radians.  Positive values draw clockwise.</param>
/// <param name="arcType">Whether the arc is drawn as a segment or a sector.</param>
/// <param name="subdivisions">The number of subdivisions in the circle with the same radius as the arc.</param>
/// <exception cref="InvalidOperationException"><c>FillArc</c> was called, but <see cref="Begin()"/> has not yet been called.</exception>
/// <remarks>The number of subdivisions in the arc is computed as <c>subdivisions * (arcAngle / 2PI)</c>.</remarks>
Adds a filled arc to the batch of figures to be rendered using up to the given number of subdivisions.
Adds a filled arc to the batch of figures to be rendered using up to the given number of subdivisions .
public void FillArc (Brush brush, Vector2 center, float radius, float startAngle, float arcAngle, ArcType arcType, int subdivisions)
        {
            if (!_inDraw)
                throw new InvalidOperationException();
            if (brush == null)
                throw new ArgumentNullException("brush");
            int vertexCount = BuildArcGeometryBuffer(center, radius, subdivisions, startAngle, arcAngle);
            RequestBufferSpace(vertexCount + 1, (vertexCount - 1) * 3);
            AddInfo(PrimitiveType.TriangleList, vertexCount + 1, (vertexCount - 1) * 3, brush);
            int baseVertexIndex = _vertexBufferIndex;
            for (int i = 0; i < vertexCount; i++)
                AddVertex(_geometryBuffer[i], brush);
            switch (arcType) {
                case ArcType.Sector:
                    AddVertex(new Vector2(center.X, center.Y), brush);
                    break;
                case ArcType.Segment:
                    AddVertex(new Vector2((_geometryBuffer[0].X + _geometryBuffer[vertexCount - 1].X) / 2, 
                        (_geometryBuffer[0].Y + _geometryBuffer[vertexCount - 1].Y) / 2), brush); 
                    break;
            }
            if (arcAngle < 0) {
                for (int i = 0; i < vertexCount - 1; i++)
                    AddTriangle(baseVertexIndex + vertexCount, baseVertexIndex + i + 1, baseVertexIndex + i);
            }
            else {
                for (int i = vertexCount - 1; i > 0; i--)
                    AddTriangle(baseVertexIndex + vertexCount, baseVertexIndex + i - 1, baseVertexIndex + i);
            }
            if (_sortMode == DrawSortMode.Immediate)
                FlushBuffer();
        }
public void FillArc ( Brush brush , Vector2 center , float radius , float startAngle , float arcAngle , ArcType arcType , int subdivisions ) { if ( ! _inDraw ) throw new InvalidOperationException ( ) ; if ( brush == null ) throw new ArgumentNullException ( " " ) ; int vertexCount = BuildArcGeometryBuffer ( center , radius , subdivisions , startAngle , arcAngle ) ; RequestBufferSpace ( vertexCount + 1 , ( vertexCount - 1 ) * 3 ) ; AddInfo ( PrimitiveType . TriangleList , vertexCount + 1 , ( vertexCount - 1 ) * 3 , brush ) ; int baseVertexIndex = _vertexBufferIndex ; for ( int i = 0 ; i < vertexCount ; i ++ ) AddVertex ( _geometryBuffer [ i ] , brush ) ; switch ( arcType ) { case ArcType . Sector : AddVertex ( new Vector2 ( center . X , center . Y ) , brush ) ; break ; case ArcType . Segment : AddVertex ( new Vector2 ( ( _geometryBuffer [ 0 ] . X + _geometryBuffer [ vertexCount - 1 ] . X ) / 2 , ( _geometryBuffer [ 0 ] . Y + _geometryBuffer [ vertexCount - 1 ] . Y ) / 2 ) , brush ) ; break ; } if ( arcAngle < 0 ) { for ( int i = 0 ; i < vertexCount - 1 ; i ++ ) AddTriangle ( baseVertexIndex + vertexCount , baseVertexIndex + i + 1 , baseVertexIndex + i ) ; } else { for ( int i = vertexCount - 1 ; i > 0 ; i -- ) AddTriangle ( baseVertexIndex + vertexCount , baseVertexIndex + i - 1 , baseVertexIndex + i ) ; } if ( _sortMode == DrawSortMode . Immediate ) FlushBuffer ( ) ; }
Adds a filled arc to the batch of figures to be rendered using up to the given number of subdivisions.
Adds a filled arc to the batch of figures to be rendered using up to the given number of subdivisions .
FillArc has not yet been called.
FillArc has not yet been called .
brush
Brush
The brush to render the shape with.
The brush to render the shape with .
center
Vector2
The center coordinate of the arc.
The center coordinate of the arc .
radius
float
The radius of the arc.
The radius of the arc .
startAngle
float
The starting angle of the arc in radians, where 0 is 3 O'Clock.
The starting angle of the arc in radians where 0 is 3 O ' Clock .
arcAngle
float
The sweep of the arc in radians.  Positive values draw clockwise.
The sweep of the arc in radians . Positive values draw clockwise .
arcType
ArcType
Whether the arc is drawn as a segment or a sector.
Whether the arc is drawn as a segment or a sector .
subdivisions
int
The number of subdivisions in the circle with the same radius as the arc.
The number of subdivisions in the circle with the same radius as the arc .
remarks
The number of subdivisions in the arc is computed as subdivisions * (arcAngle / 2PI)
The number of subdivisions in the arc is computed as subdivisions * ( arcAngle / 2PI )