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

时间:2017-02-17 11:31:33

标签: ios uiview xamarin.ios skia skiasharp

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

1 个答案:

答案 0 :(得分:6)

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

// 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);