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
Add filter effects classes #641
Conversation
@wieslawsoltes thanks a lot for working on that. in order to merge the PR and to make it more understandable to other prpgrammers, please use a more descriptive commit message in future. something like: "Added FilterUnits and PrimitiveUnits properties to SvgFilter class" "Update SvgFilter.cs" doesn't give new info, since the commit already shows that the diff is in that file. i can highly recommend to use GitExtensions which has text completion when writing a commit message. |
@tebjan ok I will write more descriptive commit messages in the feature. |
e8e7038
to
e7a73d9
Compare
@tebjan I have fixed commit messages. |
@wieslawsoltes thanks a lot, that looks good! |
I have question about public override void Process(ImageBuffer buffer)
{
// TODO: Implement feBlend filter Process().
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is still being implemented, so I add a few comments.
This PR is ready for initial review. I may add some tweaks along the way while I am trying to implement some of the filters in Svg.Skia. |
I would also like to change type of the [SvgAttribute("stdDeviation")]
public SvgNumberCollection StdDeviation
{
get { return GetAttribute("stdDeviation", false, new SvgNumberCollection() { 0f, 0f }); }
set { Attributes["stdDeviation"] = value; }
} https://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement
|
Please use |
I also had noticed this, and I think it is ok to change. Given that almost none of the filters is currently implemented correctly (Gaussian blur is there, but only partly fillfulls the spec, and also is very slow), I think this kind of changes will not be a problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be merged as is, even if the implementation of the filters itself is missing - looks like a lot of work done!
I will wait for @H1Gdev to have another look and probably merge tomorrow.
As for the commit comments: I usually use squash merges for PRs with more than one commit (except than the commits are not related), and the commit comments end up as separate lines in the comment. I usually try to sanitize these, but it is good to have already meaningful comments. |
* Fixed regression introduce by svg-net#640 * Added tests
* Small refactoring in SvgFilter
…into FilterEffects
…into FilterEffects
I did try to retrofit SvgGaussianBlur filter effect with SvgNumberCollection as StdDeviation property type but failed. My proposal is to remove current implementation of SvgGaussianBlur Process(and related code) and just fix property type. |
@mrbean-bremen @H1Gdev I have fixed all requested changes and I am done with all work I wanted to do. This is ready for final review and merge (preferable squashing merge?). |
For reference I have partially implement all the filter effects added in this PR in my Svg.Skia library. https://github.com/wieslawsoltes/Svg.Skia/blob/master/src/Svg.Skia/SvgFilterskExtensions.cs |
Source/Filter Effects/feSpecularLighting/SvgSpecularLighting.cs
Outdated
Show resolved
Hide resolved
Hello! Thank you for all of your work on this. To clarify, did this actually implement all of the filters listed, or are they not quite finished? I am using this library to render PNGs from SVGs and have been having trouble with the filters working, particularly feBlend, feComposite, and feColorMatrix. Thanks again! |
I did not implement any filters effects. |
Ah OK, thank you for confirming! |
@possibleshowdown |
What does this implement/fix? Explain your changes.
Added filter effects classes:
Added component transfer function classes:
Added light source classes:
Set correct default values for SvgFilter properties.
Added FilterUnits and PrimitiveUnits properties to SvgFilter class.
Added X, Y, Width and Height properties to SvgFilterPrimitive class.
Added SvgNumberCollection data type similar to SvgPointCollection.
Any other comments?
I would also like to change type of the
StdDeviation
property of theSvgGaussianBlur
filter effect as it's not following the SVG specification. This is off-course breaking change. I hope at least we can discuss this here as part of this PR adsSvgNumberCollection
data type and uses it extensively.https://github.com/vvvv/SVG/blob/4580a4e7874afb26c2d0b0b45a68e6b8ae65640c/Source/Filter%20Effects/feGaussianBlur/SvgGaussianBlur.cs#L221-L238
https://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement