0

Hello I am using NGraphics to draw strokes for xamarin form. In Android, I can draw the stroke with round cap enabled so the stroke of the endpoints are round. In NGraphics I still can draw the stroke but the endpoints have corners.

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
LittleFunny
  • 8,155
  • 15
  • 87
  • 198

1 Answers1

1

Short Answer: No

The NGraphic's Pen Class does not expose items like StrokeJoins and StrokeCaps.

You could always mod the source code to add those type of properties to the Pen Class and set the appropriate platform-dependent items.

i.e. In the Android implimentation, the private GetPenPaint method sets up the Android Paint object, just need to set the Paint.StrokeCap when appropriate:

`paint.StrokeCap = Paint.Cap.Round;`

Ref : https://github.com/praeclarum/NGraphics/blob/master/Platforms/NGraphics.Android/AndroidPlatform.cs#L193

Paint GetPenPaint (Pen pen)
{
    var paint = new Paint (PaintFlags.AntiAlias);
    paint.SetStyle (Paint.Style.Stroke);
    paint.SetARGB (pen.Color.A, pen.Color.R, pen.Color.G, pen.Color.B);
    paint.StrokeWidth = (float)pen.Width;

    if (pen.DashPattern != null && pen.DashPattern.Any ()) {
        var dashPathEffect = new DashPathEffect(pen.DashPattern.ToArray(), 0);
        paint.SetPathEffect(dashPathEffect);
    }

    return paint;
}
SushiHangover
  • 73,120
  • 10
  • 106
  • 165