-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Added the Win2d Path Geometry parser. #3503
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
Added the Win2d Path Geometry parser. #3503
Conversation
Thanks ratishphilip for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
@ratishphilip sorry we've been heads down updating some of our pipeline stuff recently. Just took a quick look now and noticed there were no tests associated with the PR. Especially with some of the RegEx and Math helpers it'd be good to bring in any unit tests you have as well for maintaining this work in the future and guarding against accidental regressions. Thanks! |
Hey @ratishphilip thoughts on being able to add tests for anything here? We're going to be closing out our features for the 7.0 release in the next couple of weeks here before the holidays (tentatively Dec 18th). Worst case we just move this to the next milestone. Just wanted to check-in and get your thoughts. Thanks! |
Hey @michael-hawker, sorry for the delayed response. Been a bit busy with my day job lately. I will try to update the PR this weekend. |
@michael-hawker Almost done with the unit tests. Will be updating the PR tomorrow. |
@michael-hawker The unit test cases have been added. |
…/WindowsCommunityToolkit into feature/win2dparser
…SampleApp instead.
…/WindowsCommunityToolkit into feature/win2dparser
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/CanvasPathGeometry/CanvasPathGeometryPage.xaml.cs
Outdated
Show resolved
Hide resolved
@michael-hawker All the review comments have been implemented and the comments resolved. |
…/WindowsCommunityToolkit into feature/win2dparser
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.
Thanks @ratishphilip for the sample updates. I was able to get to a few cases where typing gobblygook didn't provide an error message, but we can always improve things and catch other edge cases more later as follow-ons. I mean in the main case someone's going to copy a well known path to render, so I'm not too worried. 🙂
@Sergio0694 you all good now too? Auto-merge should take care of the rest! 🎉
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.
Looks good! 🎉
Thank you @ratishphilip for adding these APIs to the Toolkit!
Sorry I had to manually push a commit to this branch - we merged #3726 which removed the Guard
/ThrowHelper
APIs from the base Microsoft.Toolkit
package so I wanted to just refactor the code to get this PR merged in, and didn't want to bother you to basically undo the changes we requested a while back, before that other PR was in the works. Hope that's alright for you! 😄
Thanks again for your contribution! 🙌
Hey @Sergio0694 I am perfectly fine with that. 😃 Thanks for incorporating those changes. 😄👍 |
Merged! 🎉🎉🎉 Thanks for contributing this to the Toolkit @ratishphilip! I know this was one of the larger chunks of things from your own library. Hope to see more contributions in the future! I know a lot of your composition helpers would go great with the effect pipeline and animation stuff @Sergio0694 has been putting together too! |
Thanks @michael-hawker and @Sergio0694 for helping merge it to WCT. |
Fixes #3421
WPF has a Path Mini Language which is used to describe geometric paths and figures. Support for a similar language does not exist in Win2d library.
CanvasPathGeometry
class aims to resolve that.PR Type
What kind of change does this PR introduce?
What is the current behavior?
No parser for converting SVG path data to CanvasGeometry exists. Moreover, no mini language exists for defining Brushes, Strokes and StrokeStyles.
What is the current behavior?
No parser for converting SVG path data to CanvasGeometry exists. Moreover, no mini language exists for defining Brushes, Strokes and StrokeStyles.
What is the new behavior?
I have defined the Win2d Path Mini Language, which is a superset of the Path Language specification in SVG and can be used to define the following
CanvasGeometry
Color
(in hex format orVector4
format)ICanvasBrush
SolidColorBrush
LinearGradientBrush
LinearGradientBrush
withGradientStopHdr
RadialGradientBrush
RadialGradientBrush
withGradientStopHdr
CanvasStrokeStyle
CanvasStroke
which derives fromICanvasStroke
(an interface which encapsulates the attributes of a stroke - Width, Brush, Style and Transform)I have implemented the
CanvasPathGeometry
class which contains a set of static helper methods which enable the parsing of Win2d Path Mini Language as string and convert them to appropriateCanvasGeometry
,Color
,ICanvasBrush
orICanvasStroke
. Also I have added extension methods toCompositor
,CanvasPathBuilder
andCanvasDrawingSession
to build upon the aforementioned helper methods.PR Checklist
Please check if your PR fulfills the following requirements: