I'm using CreateBlendMode to change the color of an SVG drawing as follows:
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);
}
Image before
Image after
But I need the line to be dashed like the next image. It is possible?
Yes it is. Just set the PathEffect of the paint you are using.
Example:
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.