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

XAML Path geometry parsing problem with relative point #4741

Closed
Meloman19 opened this issue Apr 5, 2021 · 4 comments
Closed

XAML Path geometry parsing problem with relative point #4741

Meloman19 opened this issue Apr 5, 2021 · 4 comments
Labels
needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) no-issue-activity team-Rendering Issue for the Rendering team

Comments

@Meloman19
Copy link

Describe the bug
There is a problem with parsing the SVG path if relative coordinates are used.

Steps to reproduce the bug
Use next string as data of Path:
m 6 6 h 5 v 5 H 6 Z m 8 0 h 5 v 5 H 14 Z M 0 0 V 17 H 25 V 0 Z m 3 3 H 22 V 14 H 3 Z
or

<Path Data="m 6 6 h 5 v 5 H 6 Z m 8 0 h 5 v 5 H 14 Z M 0 0 V 17 H 25 V 0 Z m 3 3 H 22 V 14 H 3 Z"
      Stretch="Uniform"
      Width="300"
      Height="300"
      Fill="Black"/>

Expected behavior
image

Screenshots
What I've got:
image

Version Info

NuGet package version:
[WinUI 3 - Project Reunion 0.5: 0.5.0]

Additional context
If I convert coordinates to absolute, then it will be displayed correctly everywhere.
Absolute:
M 6 6 H 11 V 11 H 6 Z M 14 6 H 19 V 11 H 14 Z M 0 0 V 17 H 25 V 0 Z M 3 3 H 22 V 14 H 3 Z

What I've got:
image

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Apr 5, 2021
@StephenLPeters StephenLPeters added needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) team-Rendering Issue for the Rendering team labels Apr 5, 2021
@StephenLPeters
Copy link
Contributor

@codendone FYI

@nCastle1
Copy link

nCastle1 commented Apr 9, 2021

Possibly the same issue as #3077

@Meloman19
Copy link
Author

@nCastle1 Yeah. Same issue. But bug is not in the rendering, but in the parsing.
You can try
M 8.023 1.023 L 0.023 5.523 L 8.023 10.023 L 16.023 5.523 Z M 2.063 5.523 L 8.023 2.171 L 13.983 5.523 L 8.023 8.876 Z M 16.023 8.523 L 8.023 13.023 L 0.023 8.523 L 1.043 7.95 L 8.023 11.876 L 15.003 7.95 Z M 8.023 14.876 L 15.003 10.95 L 16.023 11.523 L 8.109 15.975 A 0.175 0.175 0 0 1 7.938 15.975 L 0.023 11.523 L 1.043 10.95 Z
instead
M 8.023 1.023 l -8 4.5 8 4.5 8-4.5 z m -5.96 4.5 l 5.96 -3.352 5.96 3.352 -5.96 3.353 z m 13.96 3 l -8 4.5 -8 -4.5 1.02 -.573 6.98 3.926 6.98 -3.926 z m -8 6.353 l 6.98 -3.926 1.02 .573 -7.914 4.452 a .175 .175 0 0 1 -.171 0 L .023 11.523 l 1.02-.573 z
And get right PathGeometry.

@StephenLPeters @codendone I dug a little deeper and I found this.
PathFigures for string with relative coordinates: m 6 6 h 5 v 5 H 6 Z m 8 0 h 5 v 5 H 14 Z M 0 0 V 17 H 25 V 0 Z m 3 3 H 22 V 14 H 3 Z

WPF Parse result
IsClosed: True | IsFilled True | StartPoint: 6;6
      PolyLineSegment: 11;6 11;11 6;11 

IsClosed: True | IsFilled True | StartPoint: 14;6
      PolyLineSegment: 19;6 19;11 14;11 

IsClosed: True | IsFilled True | StartPoint: 0;0
      PolyLineSegment: 0;17 25;17 25;0 

IsClosed: True | IsFilled True | StartPoint: 3;3
      PolyLineSegment: 22;3 22;14 3;14 
WinUI 3 Parse result
IsClosed: True | IsFilled True | StartPoint: 6;6
      LineSegment: 11;6
      LineSegment: 11;11
      LineSegment: 6;11

IsClosed: True | IsFilled True | StartPoint: 14;11
      LineSegment: 19;11
      LineSegment: 19;16
      LineSegment: 14;16

IsClosed: True | IsFilled True | StartPoint: 0;0
      LineSegment: 0;17
      LineSegment: 25;17
      LineSegment: 25;0

IsClosed: True | IsFilled True | StartPoint: 28;3
      LineSegment: 22;3
      LineSegment: 22;14
      LineSegment: 3;14

Please note that 2 and 4 PathFigures has different result. Don't mind the type of segment.
For example second PathFigure:

WPF WinUI
StartPoint 14; 6 14; 11
Point 19; 6 19; 11
Point 19; 11 19; 16
Point 14; 11 14; 16

But for absolute: M 6 6 H 11 V 11 H 6 Z M 14 6 H 19 V 11 H 14 Z M 0 0 V 17 H 25 V 0 Z M 3 3 H 22 V 14 H 3 Z

WPF Parse result
IsClosed: True | IsFilled True | StartPoint: 6;6
      PolyLineSegment: 11;6 11;11 6;11 

IsClosed: True | IsFilled True | StartPoint: 14;6
      PolyLineSegment: 19;6 19;11 14;11 

IsClosed: True | IsFilled True | StartPoint: 0;0
      PolyLineSegment: 0;17 25;17 25;0 

IsClosed: True | IsFilled True | StartPoint: 3;3
      PolyLineSegment: 22;3 22;14 3;14 
WinUI 3 Parse result
IsClosed: True | IsFilled True | StartPoint: 6;6
      LineSegment: 11;6
      LineSegment: 11;11
      LineSegment: 6;11

IsClosed: True | IsFilled True | StartPoint: 14;6
      LineSegment: 19;6
      LineSegment: 19;11
      LineSegment: 14;11

IsClosed: True | IsFilled True | StartPoint: 0;0
      LineSegment: 0;17
      LineSegment: 25;17
      LineSegment: 25;0

IsClosed: True | IsFilled True | StartPoint: 3;3
      LineSegment: 22;3
      LineSegment: 22;14
      LineSegment: 3;14

Second PathFigure:

WPF WinUI
StartPoint 14; 6 14; 6
Point 19; 6 19; 6
Point 19; 11 19; 11
Point 14; 11 14; 11

As you can see WPF has same parsing result in both cases. But WinUI has parsing issue with relative points.

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) no-issue-activity team-Rendering Issue for the Rendering team
Projects
None yet
Development

No branches or pull requests

4 participants