Hello,
Welcome to our Microsoft Q&A platform!
What is the widht of the round cap of a line in skiasharp
The line's width is designed by the SKPaint.StrokeWidth
property. You coud define the width before drawing the line.
I want to draw a line which has only one cap but it will have two
It doesn't support to draw only one round cap directly, try to draw the line twice to achieve the style.
Check the code:
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
{
SKImageInfo info = args.Info;
SKSurface surface = args.Surface;
SKCanvas canvas = surface.Canvas;
canvas.Clear();
SKPaint thickLinePaint = new SKPaint
{
Style = SKPaintStyle.Stroke,
Color = SKColors.Orange,
StrokeWidth = 50
};
float y = textPaint.FontSpacing;
thickLinePaint.StrokeCap = SKStrokeCap.Round;
canvas.DrawLine(xLine1, y, 200, y, thickLinePaint);
thickLinePaint.StrokeCap = SKStrokeCap.Butt;
thickLinePaint.Color = SKColors.Red;
canvas.DrawLine(200, y, 500, y, thickLinePaint);
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.