Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion SvgXF/SvgXF/Icon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ public string ResourceId

#endregion

#region Color

public static readonly BindableProperty ColorProperty = BindableProperty.Create(
nameof(Color), typeof(Color), typeof(SVGIcon),Color.Black, propertyChanged: RedrawCanvas);

public Color Color
{
get => (Color)GetValue(ColorProperty);
set => SetValue(ColorProperty, value);
}

#endregion

#endregion

#region Constructor
Expand Down Expand Up @@ -78,7 +91,15 @@ private void CanvasViewOnPaintSurface(object sender, SKPaintSurfaceEventArgs arg
canvas.Scale(ratio);
canvas.Translate(-bounds.MidX, -bounds.MidY);

canvas.DrawPicture(svg.Picture);
var paint = new SKPaint()
{
ColorFilter = SKColorFilter.CreateBlendMode(
this.Color.ToSKColor(),
SKBlendMode.SrcIn
)
};

canvas.DrawPicture(svg.Picture,paint);
}
}

Expand Down