Convert image to gray scale
Describe the solution you'd like
I want to convert the image to gray sacle. I've tried OverrideColor, OverrideFillColor and OverrideStrokeColor, but the effect is not satisfying. Just like convert the png image to gray scale, how to do it in SVGImage? Or is there any way that I can get the rendered image to modify it by myself?
SvgImage is no PNG image. It converts SVG Parts to WPF Drawing Objects. Maybe code could be added, to convert each drawing color to a grayscale one. Needs to be tested. If you need it, maybe you could create a pull request for this. I've no time to work on this.
For the moment, I managed to display the <svg> in gray scale, by using ShaderEffect based on a custom (but a simplified one, compared to others on the Internet) shader:
sampler2D input : register(s0);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = tex2D(input, uv);
float gray = dot(color.rgb, float3(0.3, 0.59, 0.11));
return float4(gray, gray, gray, color.a);
}
This approach satisfies my need. I'll consider to create a PR some time, maybe add a bool property to control the gray scale visual effect.