Open neinseg opened 2 years ago
I accept a slightly modified variant of this:
A new command tag(string)
will be added. There will be no specification about how the tag content is formed, it is just an arbitrarily sized byte stream that can be used to identify or control custom renderers. Tags can be ignored by conforming renderers.
I think that's a really neat solution.
Something like this would also be useful to e.g. have an entire icon theme in just one image file. Then you pick the group of the icon you need, which could itself build on top of some base icon. I can imagine this being useful for especially websites, giving you all your icons in just one request.
As it's requested right now:
The new command will be called tag
and has command index 11. The layout will be like this:
command-name: "tag"
command-index: 11
layout:
length: varuint
data: [length]u8
Nice!
What’s the spec on the u8
payload? UTF-8? /[a-zA-Z0-9]+/
? UUID? Any random blob of no assumptions?
The last thing:
data
is an arbitrary blob without assumptions for now. As it's an application specific command so all implementations are free to ignore the blob.
Something I often do with SVGs is to have a "master SVG" that has named objects and groups, then selectively change the style of some of these groups during rendering. Thinking about TinyVG use cases, imagine a "Checkbox" SVG. It might look something like this:
The renderer can then select any of the styles by rendering with an override of `fill="none" for one of the IDs.
I don't think that explicitly specifying this type of CSS-like behavior makes sense as part of a format like TinyVG. However, it would be nice if it would be possible to uniquely identify individual elements or groups of elements in a TinyVG file from the outside.
One way of doing this could be to have "id start" and "id end" commands in between graphical commands. These would have no effect on the actual graphical rendering and can be ignored during rendering since in contrast to SVG groups they do not change graphical state such as style or transform. IDs could be variable-length strings, which would not make implementing a parser worse since there are already variable-length integers and lists anyway. Example TinyVG file structure for the checkmark example above: