如何使用Skia Sharp添加rect并将填充颜色和笔触颜色应用于该对象?

Dev*_*raj 4 uiview xamarin.ios skia ios skiasharp

如何使用Skia Sharp添加rect或任何形状,并在iOS中将填充颜色和笔触颜色应用于该对象

Mat*_*hew 8

要绘制填充和描边,您将需要执行两次绘制操作:

// the rectangle
var rect = SKRect.Create(10, 10, 100, 100);

// the brush (fill with blue)
var paint = new SKPaint {
    Style = SKPaintStyle.Fill,
    Color = SKColors.Blue
};

// draw fill
canvas.DrawRect(rect, paint);

// change the brush (stroke with red)
paint.Style = SKPaintStyle.Stroke;
paint.Color = SKColors.Red;

// draw stroke
canvas.DrawRect(rect, paint);
Run Code Online (Sandbox Code Playgroud)