Source/OxyPlot.Avalonia/CanvasRenderContext.cs
/// <summary>
/// Draws the line segments by stream geometry.
/// </summary>
/// <param name="points">The points.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The thickness.</param>
/// <param name="dashArray">The dash array. Use <c>null</c> to get a solid line.</param>
/// <param name="lineJoin">The line join.</param>
/// <param name="aliased">Draw aliased line if set to <c>true</c> .</param>
Draws the line segments by stream geometry.
Draws the line segments by stream geometry .
private void DrawLineSegmentsByStreamGeometry(
            IList<ScreenPoint> points,
            OxyColor stroke,
            double thickness,
            double[] dashArray,
            LineJoin lineJoin,
            bool aliased)
        {
            StreamGeometry streamGeometry = null;
            StreamGeometryContext streamGeometryContext = null;
            var count = 0;
            for (int i = 0; i + 1 < points.Count; i += 2)
            {
                if (streamGeometry == null)
                {
                    streamGeometry = new StreamGeometry();
                    streamGeometryContext = streamGeometry.Open();
                }
                streamGeometryContext.BeginFigure(ToPoint(points[i], aliased), false);
                streamGeometryContext.LineTo(ToPoint(points[i + 1], aliased));
                count++;
                if (count > MaxFiguresPerGeometry || dashArray != null)
                {
                    streamGeometryContext.Dispose();
                    var path = CreateAndAdd<Path>();
                    SetStroke(path, stroke, thickness, lineJoin, dashArray, 0, aliased);
                    path.Data = streamGeometry;
                    streamGeometry = null;
                    count = 0;
                }
            }
            if (streamGeometry != null)
            {
                streamGeometryContext.Dispose();
                var path = CreateAndAdd<Path>();
                SetStroke(path, stroke, thickness, lineJoin, null, 0, aliased);
                path.Data = streamGeometry;
            }
        }
private void DrawLineSegmentsByStreamGeometry ( IList < ScreenPoint > points , OxyColor stroke , double thickness , double [ ] dashArray , LineJoin lineJoin , bool aliased ) { StreamGeometry streamGeometry = null ; StreamGeometryContext streamGeometryContext = null ; var count = 0 ; for ( int i = 0 ; i + 1 < points . Count ; i += 2 ) { if ( streamGeometry == null ) { streamGeometry = new StreamGeometry ( ) ; streamGeometryContext = streamGeometry . Open ( ) ; } streamGeometryContext . BeginFigure ( ToPoint ( points [ i ] , aliased ) , false ) ; streamGeometryContext . LineTo ( ToPoint ( points [ i + 1 ] , aliased ) ) ; count ++ ; if ( count > MaxFiguresPerGeometry || dashArray != null ) { streamGeometryContext . Dispose ( ) ; var path = CreateAndAdd < Path > ( ) ; SetStroke ( path , stroke , thickness , lineJoin , dashArray , 0 , aliased ) ; path . Data = streamGeometry ; streamGeometry = null ; count = 0 ; } } if ( streamGeometry != null ) { streamGeometryContext . Dispose ( ) ; var path = CreateAndAdd < Path > ( ) ; SetStroke ( path , stroke , thickness , lineJoin , null , 0 , aliased ) ; path . Data = streamGeometry ; } }
Draws the line segments by stream geometry.
Draws the line segments by stream geometry .
// Must limit the number of figures, otherwise drawing errors...
points
IList<ScreenPoint>
None
stroke
OxyColor
The stroke color.
The stroke color .
thickness
double
None
dashArray
double[]
The dash array. Use null
The dash array . Use null
lineJoin
LineJoin
The line join.
The line join .
aliased
bool
Draw aliased line if set to true
Draw aliased line if set to true