LilyPath/DrawBatch.cs
/// <summary>
/// Adds a filled quadrilateral to the batch of figures to be rendered.
/// </summary>
/// <param name="brush">The brush to render the shape with.</param>
/// <param name="points">An array containing the coordinates of the quad.</param>
/// <param name="offset">The offset into the points array.</param>
/// <param name="angle">The angle to rotate the quad around its weighted center in radians.  Positive values rotate clockwise.</param>
/// <exception cref="InvalidOperationException"><c>FillQuad</c> was called, but <see cref="Begin()"/> has not yet been called.</exception>
Adds a filled quadrilateral to the batch of figures to be rendered.
Adds a filled quadrilateral to the batch of figures to be rendered .
public void FillQuad (Brush brush, Vector2[] points, int offset, float angle)
        {
            if (!_inDraw)
                throw new InvalidOperationException();
            if (brush == null)
                throw new ArgumentNullException("brush");
            if (points == null)
                throw new ArgumentNullException("points");
            if (points.Length < offset + 4)
                throw new ArgumentException("Points array is too small for the given offset.");
            RequestBufferSpace(4, 6);
            AddInfo(PrimitiveType.TriangleList, 4, 6, brush);
            int baseVertexIndex = _vertexBufferIndex;
            if (points != _geometryBuffer)
                Array.Copy(points, _geometryBuffer, 4);
            if (angle != 0) {
                float centerX = (_geometryBuffer[0].X + _geometryBuffer[1].X + _geometryBuffer[2].X + _geometryBuffer[3].X) / 4;
                float centerY = (_geometryBuffer[0].Y + _geometryBuffer[1].Y + _geometryBuffer[2].Y + _geometryBuffer[3].Y) / 4;
                Vector2 center = new Vector2(centerX, centerY);
                Matrix transform = Matrix.CreateRotationZ(angle);
                transform.Translation = new Vector3(center, 0);
                for (int i = 0; i < 4; i++)
                    _geometryBuffer[i] = Vector2.Transform(_geometryBuffer[i] - center, transform);
            }
            for (int i = 0; i < 4; i++)
                AddVertex(_geometryBuffer[i], brush);
            AddTriangle(baseVertexIndex + 0, baseVertexIndex + 1, baseVertexIndex + 3);
            AddTriangle(baseVertexIndex + 1, baseVertexIndex + 2, baseVertexIndex + 3);
            if (_sortMode == DrawSortMode.Immediate)
                FlushBuffer();
        }
public void FillQuad ( Brush brush , Vector2 [ ] points , int offset , float angle ) { if ( ! _inDraw ) throw new InvalidOperationException ( ) ; if ( brush == null ) throw new ArgumentNullException ( " " ) ; if ( points == null ) throw new ArgumentNullException ( " " ) ; if ( points . Length < offset + 4 ) throw new ArgumentException ( " " ) ; RequestBufferSpace ( 4 , 6 ) ; AddInfo ( PrimitiveType . TriangleList , 4 , 6 , brush ) ; int baseVertexIndex = _vertexBufferIndex ; if ( points != _geometryBuffer ) Array . Copy ( points , _geometryBuffer , 4 ) ; if ( angle != 0 ) { float centerX = ( _geometryBuffer [ 0 ] . X + _geometryBuffer [ 1 ] . X + _geometryBuffer [ 2 ] . X + _geometryBuffer [ 3 ] . X ) / 4 ; float centerY = ( _geometryBuffer [ 0 ] . Y + _geometryBuffer [ 1 ] . Y + _geometryBuffer [ 2 ] . Y + _geometryBuffer [ 3 ] . Y ) / 4 ; Vector2 center = new Vector2 ( centerX , centerY ) ; Matrix transform = Matrix . CreateRotationZ ( angle ) ; transform . Translation = new Vector3 ( center , 0 ) ; for ( int i = 0 ; i < 4 ; i ++ ) _geometryBuffer [ i ] = Vector2 . Transform ( _geometryBuffer [ i ] - center , transform ) ; } for ( int i = 0 ; i < 4 ; i ++ ) AddVertex ( _geometryBuffer [ i ] , brush ) ; AddTriangle ( baseVertexIndex + 0 , baseVertexIndex + 1 , baseVertexIndex + 3 ) ; AddTriangle ( baseVertexIndex + 1 , baseVertexIndex + 2 , baseVertexIndex + 3 ) ; if ( _sortMode == DrawSortMode . Immediate ) FlushBuffer ( ) ; }
Adds a filled quadrilateral to the batch of figures to be rendered.
Adds a filled quadrilateral to the batch of figures to be rendered .
FillQuad has not yet been called.
FillQuad has not yet been called .
brush
Brush
The brush to render the shape with.
The brush to render the shape with .
points
Vector2[]
An array containing the coordinates of the quad.
An array containing the coordinates of the quad .
offset
int
The offset into the points array.
The offset into the points array .
angle
float
The angle to rotate the quad around its weighted center in radians.  Positive values rotate clockwise.
The angle to rotate the quad around its weighted center in radians . Positive values rotate clockwise .