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

common Paint: Add name getter/setter API #1285

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

common Paint: Add name getter/setter API #1285

wants to merge 1 commit into from

Conversation

JSUYA
Copy link
Member

@JSUYA JSUYA commented Nov 29, 2022

Adds an API that can set/get string type name to tvgPaint.
This can be used when the user needs to traverse the scene tree or find a specific instance.
+) The SVG's "id" attribute is set to name when SVG is loaded.

@JSUYA
Copy link
Member Author

JSUYA commented Nov 29, 2022

This is a simple solution for #1276.
I think the size(cost) of tvgPaint can up unnecessarily. and it can not be used universally except in special cases.
What do you think?

@kariem2k
Copy link

kariem2k commented Dec 6, 2022

Maybe a hashed string can be stored instead of the actual string itself? something like int getPaintId(); and now the user can just do if(paint->getPaintId() == "MySVGShape1"_hs) or if(paint->getPaintId() == hash("MySVGShape1")).

@kariem2k
Copy link

kariem2k commented Dec 6, 2022

And if the user wants to have a full blown svg "reflection", he can just use a different svg parser building the tree and use the hashed ids coming from thorgvg paint->getPaintId() for lookup in the svg dom retrieving more detailed info like classes, hrefs, or the actual id string.

The PaintId can be auto generated as well if it is not coming from and svg for consistency (but this is just a suggestion)

@hermet hermet added the feature New feature additions label Dec 8, 2022
@thorvg thorvg deleted a comment from github-actions bot Dec 26, 2023
@hermet hermet closed this Mar 19, 2024
@hermet hermet added the invalid This doesn't seem right label Mar 19, 2024
@hermet hermet reopened this Mar 19, 2024
@hermet hermet removed the invalid This doesn't seem right label Mar 19, 2024
Adds an API that can set/get string type name to tvgPaint.
This can be used when the user needs to traverse the scene tree
or find a specific instance.
+) The SVG's "id" attribute is set to name when SVG is loaded.
@JSUYA
Copy link
Member Author

JSUYA commented Mar 19, 2024

Rebased PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature additions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants