Here's my code:
public void DrawCanvas(object sender, SKPaintSurfaceEventArgs psea)
{
psea.Surface.Canvas.Clear();
SKRect canvasRect = SKRect.Create(psea.Info.Size);
var r = 20;
var paint = new SKPaint();
paint.IsAntialias = true;
//paint.StrokeCap = SKStrokeCap.Round; // no need on a closed loop
// fill
paint.Style = SKPaintStyle.Fill;
paint.Color = Color.Gray.ToSKColor();
psea.Surface.Canvas.DrawRoundRect(canvasRect, r, r, paint);
// border
paint.Style = SKPaintStyle.Stroke;
paint.Color = Color.Red.ToSKColor();
paint.StrokeWidth = 4;
psea.Surface.Canvas.DrawRoundRect(canvasRect, r, r, paint);
}
Here's the result:
Why are the corners so cheap looking? Fill will round nice and sharp, but Stroke is blocky.
Should I be going about this a different way? I noticed there is a SKPaintStyle.StrokeAndFill style, but I didn't see a way to set two different colors in SKPaint (for fill vs stroke), so I assume drawing twice like this is the right approach.