Skip to content

Conversation

@NGExplorer
Copy link
Contributor

@NGExplorer NGExplorer commented Feb 12, 2025

Fixes #232

Some GPU does not have 'arc' so we can use cubic bezier for such case.
When GPU does not support 'arc' command Circle can be rendered using 2 arcs

@mathandy Please review and let us know if any changes are required.

HKPTech and others added 7 commits October 9, 2024 19:37
…and add cubic curve instead

'arc' command in path-data is not supported in vglite toolkit

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
There needs to be a space between command and point data so that we
can split draw commands and its arguments correctly.

Signed-off-by: Nilam Gaikwad <nilam.gaikwad@nxp.com>
…missing or empty values

Signed-off-by: Kratika Jain <kratika.jain@nxp.com>
…if no dedicated end path is provided

Introduce an 'is_polygon' flag in 'polygon2pathd' function to handle the end path
in polyline and polygon

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
if path string or is_polygon flag is enableed then append path given in input
if path string and is_polygon flag is enable then append 'z' path

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
…st point and draw clockwise

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
Add Modified by NXP Copyright

Signed-off-by: Nilam Gaikwad <nilam.gaikwad@nxp.com>
@NGExplorer NGExplorer marked this pull request as draft February 12, 2025 11:42
@NGExplorer NGExplorer marked this pull request as ready for review February 12, 2025 11:44
@NGExplorer NGExplorer changed the title Release/vglite tools 2.0 Upstream svgpathtools improvement Feb 13, 2025
@nicusorcitu
Copy link

@mathandy can you please review and integrate this PR?
Thanks.

points = COORD_PAIR_TMPLT.findall(polyline.get('points', ''))
raw_points = polyline.get('points', '')
if not raw_points:
points = [(0,0)]
Copy link
Owner

Choose a reason for hiding this comment

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

points = [(0,0)]

This doesn't seem right, can you explain?

Copy link
Contributor Author

@NGExplorer NGExplorer May 5, 2025

Choose a reason for hiding this comment

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

Hello @mathandy ,

Explanation:
In polyline2pathd() Line #L65 closed variable computation don't validate if there are points.

e.g. in one of SVGT12 test vector following was generating exception

As a result we used [(0,0)].

While more digging into SVGT12 specification we find that
Reference: https://www.w3.org/TR/SVG2/shapes.html#PolygonElement
The initial value, (none), indicates that the polygon element is valid, but does not render.
As a result, we've modified our application to not call polyline2pathd() in such cases.
We will update this PR in 1-2 days after internal testing.

ryKappa = ry * PATH_KAPPA;

return d + 'z'
#According to the SVG specification (https://lists.w3.org/Archives/Public/www-archive/2005May/att-0005/SVGT12_Main.pdf),
Copy link
Owner

Choose a reason for hiding this comment

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

I think this should be an option, we should let users continue using arcs if they want, and for now at least.

Let's make that the default unless there is a very good reason this new behavior should be the default.

We could

  • add an argument like use_cubics=False
  • we could also default to True if some environmental variable is set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @mathandy , We have incorporated this suggestion. We'll upstream our changes in this PR in 1-2 days.

@mathandy
Copy link
Owner

@mathandy can you please review and integrate this PR? Thanks.

Done! Sorry for the delay and thanks for the nice MR. I suggested some changes. Please keep in mind, I try to avoid breaking changes when possible and practical in this repo.

@mathandy
Copy link
Owner

@mathandy can you please review and integrate this PR? Thanks.

Done! Sorry for the delay and thanks for the nice MR. I suggested some changes. Please keep in mind, I try to avoid breaking changes when possible and practical in this repo.

cc @NGExplorer

@NGExplorer
Copy link
Contributor Author

Hello @mathandy ,

Thank you for sharing improvements. We'll incorporate this suggestions and update you.

Best Regards,

Nilam

NGExplorer and others added 3 commits May 5, 2025 15:25
Hello @mathandy , We have incorporated this suggestion. We'll upstream our changes in this PR in 1-2 days.

Co-authored-by: Andrew Port <andyaport@gmail.com>
Add `use_cubics` flag to optionally select between arc and cubic

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
…data in polylines and polygons

Signed-off-by: Harikrushna Parmar <harikrushna.parmar@nxp.com>
@NGExplorer
Copy link
Contributor Author

@mathandy ,

We have incorporated all of your suggestions, please review.

Best Regards,

Nilam

x3, y3 = x, y + h

d = ("M{} {} L {} {} L {} {} L {} {} z"
d = ("M {} {} L {} {} L {} {} L {} {} z"
Copy link
Owner

Choose a reason for hiding this comment

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

Does this change have an effect?

@mathandy
Copy link
Owner

mathandy commented May 5, 2025

I need to update the CI. Working on it.

@mathandy
Copy link
Owner

mathandy commented May 8, 2025

@NGExplorer CI is working again 🎉. I've also dropped support for python<3.8 (so we can now use type annotations, which I'm personally happy about).

I made some additional requests, sorry I missed these issues the first time around.
Please rebase and make the changes and I think you'll be ready to go assuming CI passes.

I may need to run CI manually for you (due to github rules for first time contributors in a repo possibly), but I'll keep an eye out for updates and run it as soon as I see any.

Thanks again!

@mathandy
Copy link
Owner

^ cc @NilamG

@NGExplorer
Copy link
Contributor Author

@mathandy

Declining this PR vglite-tools-2.0 was for shape-only toolkit release.
Changes are incorporated into PR: #236
vglite-tools-2.1 include text,image support

@NGExplorer NGExplorer closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement to svgpathtools

4 participants