[英]Is it possible to access underlying Xamarin UI elements using SkiaSharp?
[英]When using SkiaSharp SKColorFilter.CreateBlendMode is it possible to create a dashed line?
我正在使用 CreateBlendMode 更改 SVG 绘图的颜色,如下所示:
public Color TintColor;
TintColor = Colors.LawnGreen;
using (var paint = new SKPaint())
{
paint.ColorFilter = SKColorFilter.CreateBlendMode(SKColor.Parse(TintColor.ToHex()),
SKBlendMode.SrcIn);
canvas.DrawPicture(Picture, position.X, position.Y, paint);
}
之前的图片
之后的图像
但我需要像下一张图片一样虚线。 有可能的?
是的。 只需设置您正在使用的油漆的 PathEffect 即可。
例子:
SKPaint paint = new SKPaint();
paint.Style = SKPaintStyle.Stroke;
paint.StrokeWidth = 1.5f;
SKRect rect = new SKRect(_MouseDownPt.X, _MouseDownPt.Y, _MouseMovePt.X, _MouseMovePt.Y);
paint.PathEffect = SKPathEffect.CreateDash(new float[] {10,6},0);
paint.Color = new SKColor(0xaa,0x40,0);
paint.BlendMode = SKBlendMode.ColorDodge;
canvas.DrawRect(rect,paint);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.