LilyPath/DrawBatch.cs
/// <summary>
/// Adds a primitive line segment 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="p0">The first point of the line segment.</param>
/// <param name="p1">The second point of the line segment.</param>
/// <exception cref="InvalidOperationException"><c>DrawPrimitiveLine</c> was called, but <see cref="Begin()"/> has not yet been called.</exception>
Adds a primitive line segment path to the batch of figures to be rendered.
Adds a primitive line segment path to the batch of figures to be rendered .
public void DrawPrimitiveLine (Pen pen, Vector2 p0, Vector2 p1)
        {
            if (!_inDraw)
                throw new InvalidOperationException();
            if (pen == null)
                throw new ArgumentNullException("pen");
            RequestBufferSpace(2, 2);
            AddInfo(PrimitiveType.LineList, 2, 2, pen.Brush);
            int baseVertexIndex = _vertexBufferIndex;
            _vertexBuffer[_vertexBufferIndex++] = new VertexPositionColorTexture(new Vector3(p0.X, p0.Y, 0), pen.Color, p0);
            _vertexBuffer[_vertexBufferIndex++] = new VertexPositionColorTexture(new Vector3(p1.X, p1.Y, 0), pen.Color, p1);
            _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex);
            _indexBuffer[_indexBufferIndex++] = (short)(baseVertexIndex + 1);
            if (_sortMode == DrawSortMode.Immediate)
                FlushBuffer();
        }
public void DrawPrimitiveLine ( Pen pen , Vector2 p0 , Vector2 p1 ) { if ( ! _inDraw ) throw new InvalidOperationException ( ) ; if ( pen == null ) throw new ArgumentNullException ( " " ) ; RequestBufferSpace ( 2 , 2 ) ; AddInfo ( PrimitiveType . LineList , 2 , 2 , pen . Brush ) ; int baseVertexIndex = _vertexBufferIndex ; _vertexBuffer [ _vertexBufferIndex ++ ] = new VertexPositionColorTexture ( new Vector3 ( p0 . X , p0 . Y , 0 ) , pen . Color , p0 ) ; _vertexBuffer [ _vertexBufferIndex ++ ] = new VertexPositionColorTexture ( new Vector3 ( p1 . X , p1 . Y , 0 ) , pen . Color , p1 ) ; _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex ) ; _indexBuffer [ _indexBufferIndex ++ ] = ( short ) ( baseVertexIndex + 1 ) ; if ( _sortMode == DrawSortMode . Immediate ) FlushBuffer ( ) ; }
Adds a primitive line segment path to the batch of figures to be rendered.
Adds a primitive line segment path to the batch of figures to be rendered .
DrawPrimitiveLine has not yet been called.
DrawPrimitiveLine 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 .
p0
Vector2
The first point of the line segment.
The first point of the line segment .
p1
Vector2
The second point of the line segment.
The second point of the line segment .