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

vello_svg: Use affine transformation #292

Merged
merged 2 commits into from
Mar 10, 2023

Conversation

msiglreith
Copy link
Collaborator

Use the affine transformation option from vello instead of directly transforming the path data.
This correctly applies the transformation for other parameters as well (e.g stroke width).

Test file: https://w3.impa.br/~diego/projects/Neh20/inputs/timings/spiral.svg

Before After
grafik grafik

… data

Correctly apply the transformation for other parameters as well (e.g stroke width)
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

I can reproduce the test scene issues shown.

@@ -65,14 +65,22 @@ pub fn render_tree_with<F: FnMut(&mut SceneBuilder, &usvg::Node) -> Result<(), E
) -> Result<(), E> {
for elt in svg.root.descendants() {
let transform = elt.abs_transform();
let transform = Affine::new([
transform.a,
transform.b,
Copy link
Member

Choose a reason for hiding this comment

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

This is some nasty code. Technically,

        let usvg::Transform { a, b, c, d, e, f } = elt.abs_transform();
        let transform = Affine::new([a, b, c, d, e, f]);

takes up less vertical space. It's a shame usvg::Transform doesn't provide a to_array or equivalent, but I haven't found one

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, updated that part

@DJMcNab
Copy link
Member

DJMcNab commented Mar 10, 2023

@msiglreith according to my information, you should be able to merge this PR. Standard procedure in our repos is for the author to merge them after approving review.

(Also, you should be eligible for org membership; we don't have a process for arranging that, but if you want it, let me know on Zulip (in #gpu would be fine) and we confirm that. I've put a note in for the next office hours to find a better place for these kinds of messages)

@msiglreith msiglreith merged commit dccd59a into linebender:main Mar 10, 2023
@msiglreith msiglreith deleted the svg-transform branch March 10, 2023 11:36
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.

2 participants