Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SvgColourMatrixFix fix #540

Merged
merged 7 commits into from
Aug 5, 2019
2 changes: 1 addition & 1 deletion Source/Filter Effects/feColourMatrix/SvgColourMatrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public override void Process(ImageBuffer buffer)
};
break;
default: // Matrix
var parts = this.Values.Replace(" ", " ").Split(new char[] { ' ', '\t', '\n', '\r', ',' });
var parts = this.Values.Split(new char[] { ' ', '\t', '\n', '\r', ',' }, StringSplitOptions.RemoveEmptyEntries);
colorMatrixElements = new float[5][];
Copy link
Member

@mrbean-bremen mrbean-bremen Aug 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - good catch! Could you add your test svg together with the corresponding png as a regression test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do this but later if that's ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrbean-bremen Seems like the png is not rendered correctly using SVG lib. The issue was only related to the string parsing not rendering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SVGViewer_2019-08-04_22-03-26

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output from my renderer:
element-feColorMatrix

You can see one issue, the Filter property is inherited by Children of the use element, which is not what spec says. The Fileter property is not inheritable: https://www.w3.org/TR/SVG11/filters.html#FilterProperty, the same issue I had was with Opacity: https://www.w3.org/TR/SVG11/masking.html#ObjectAndGroupOpacityProperties

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging into this! I will merge as is in this case. Filters are generally very poorly supported (see #43), so I'm not too surprised by this, though the inheritance problem is something that certainly shall be fixed.

for (int i = 0; i < 4; i++)
{
Expand Down