Skip to content

accessor: revised the usage with the modern tvg accessor style#33

Merged
hermet merged 1 commit into
mainfrom
hermet/accessor
Apr 7, 2026
Merged

accessor: revised the usage with the modern tvg accessor style#33
hermet merged 1 commit into
mainfrom
hermet/accessor

Conversation

@hermet
Copy link
Copy Markdown
Member

@hermet hermet commented Apr 5, 2026

@hermet hermet self-assigned this Apr 5, 2026
@hermet hermet added the enhancement Improve examples label Apr 5, 2026
Copilot AI review requested due to automatic review settings April 5, 2026 06:06
@hermet hermet marked this pull request as draft April 5, 2026 06:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Accessor example to use the newer ThorVG accessor workflow for reaching SVG internals, including ID-based traversal and direct lookup of SVG nodes.

Changes:

  • Enables SVG internal accessibility on tvg::Picture before loading the SVG.
  • Reworks the accessor traversal callback to identify and modify a node by SVG ID ("star").
  • Keeps (and clarifies) a second approach using direct access via picture->paint(tvg::Accessor::id(...)).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Accessor.cpp
Comment thread src/Accessor.cpp
Comment thread src/Accessor.cpp
Comment thread src/Accessor.cpp
Comment thread src/Accessor.cpp Outdated
@hermet
Copy link
Copy Markdown
Member Author

hermet commented Apr 5, 2026

required: thorvg/thorvg#4294

@hermet hermet force-pushed the hermet/accessor branch from 2f7f74a to 5403bff Compare April 7, 2026 10:57
@hermet hermet marked this pull request as ready for review April 7, 2026 10:57
Copilot AI review requested due to automatic review settings April 7, 2026 10:57
@hermet hermet merged commit f4beb99 into main Apr 7, 2026
3 checks passed
@hermet hermet deleted the hermet/accessor branch April 7, 2026 10:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Accessor.cpp
Comment on lines +37 to +41
picture->accessible = true; // allow accessing to svg internals, it must be set before svg load call.
picture->load(EXAMPLE_DIR"/svg/favorite_on.svg");
picture->size(w, h);

/* 1. This demonstartes a traversing the internal scene tree of the SVG picture. */
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

Spelling/grammar in comments: "demonstartes" should be "demonstrates", and the phrasing "allow accessing to svg internals" is ungrammatical (consider "allow access to SVG internals").

Suggested change
picture->accessible = true; // allow accessing to svg internals, it must be set before svg load call.
picture->load(EXAMPLE_DIR"/svg/favorite_on.svg");
picture->size(w, h);
/* 1. This demonstartes a traversing the internal scene tree of the SVG picture. */
picture->accessible = true; // Allow access to SVG internals; it must be set before the SVG load call.
picture->load(EXAMPLE_DIR"/svg/favorite_on.svg");
picture->size(w, h);
/* 1. This demonstrates traversing the internal scene tree of the SVG picture. */

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants