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

[Proposal] Templates / Repeated elements #8

Open
rsheeter opened this issue Dec 21, 2021 · 6 comments
Open

[Proposal] Templates / Repeated elements #8

rsheeter opened this issue Dec 21, 2021 · 6 comments
Labels
accepted This proposal was accepted proposal New feature or request

Comments

@rsheeter
Copy link

QQ, from a quick skim it seems to me that repeated identical shapes must be fully reproduced? - apologies if I simply misunderstood.

If you provide the ability to reuse parts you may more significantly outperform svg on size in some cases. For example, in COLRv1 we allow reuse with a new fill and a transform applied.

@ikskuh ikskuh added the proposal New feature or request label Dec 21, 2021
@ikskuh ikskuh changed the title Reusable parts [Proposal] Templates / Repeated elements Dec 21, 2021
@ikskuh
Copy link
Contributor

ikskuh commented Dec 21, 2021

Yes, this is something i'm still considering as it can make repetetive graphics a lot smaller. SVG can do that as well

@ikskuh ikskuh added this to the Version 1 - Feature Final milestone Dec 22, 2021
@ikskuh
Copy link
Contributor

ikskuh commented Feb 3, 2022

I think this can be implemented reasonably easily by calling the parser/interpreter recursively. As it also reduces the file size, we can load complexer graphics in less memory, so seeking shouldn't be a huge problem.

My current idea would be two new commands:

  • recurse(offset, count): Replay commands starting at byte offset into the file and repay count commands
  • setOffset(x, y): Applies a global offset to all coordinates. This alone allows moving things more easily in a file.

@ikskuh ikskuh added the accepted This proposal was accepted label Feb 3, 2022
@neinseg
Copy link

neinseg commented Feb 4, 2022

My current idea would be two new commands:

something like setRotation(angle, center_x, center_y) would be useful here.

@ikskuh
Copy link
Contributor

ikskuh commented Feb 4, 2022

Oh yeah, that's a good idea. This would allow a lot of stuff to be made. I'll think a bit about precise semantics, but i'm already happy with the idea. With offset and rotation around point you can probably duplicate any part of the image into another position. Not sure if we should support scale/shearing, as those usually are more abused than used

@rsheeter
Copy link
Author

rsheeter commented Feb 4, 2022

Reuse scaled is definitely useful. Shear ... I'm not sure how often it's used but IMO it's odd to have everything except shear. Maybe just off a setTransform that takes a full affine matrix as a fallback?

@ikskuh
Copy link
Contributor

ikskuh commented Feb 4, 2022

Maybe just off a setTransform that takes a full affine matrix as a fallback?

This is something i wanna prevent, but maybe it's the smarter idea. Encoding-wise it would be better to have offset, rotate, scale tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal was accepted proposal New feature or request
Development

No branches or pull requests

3 participants