Open rsheeter opened 2 years ago
Yes, this is something i'm still considering as it can make repetetive graphics a lot smaller. SVG can do that as well
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
commandssetOffset(x, y)
: Applies a global offset to all coordinates. This alone allows moving things more easily in a file.My current idea would be two new commands:
something like setRotation(angle, center_x, center_y)
would be useful here.
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
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?
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
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.