Live data from Hacker News

SVG: The Good, the Bad and the Ugly

eisfunke.com

1–10 of 228 posts

Re: SVG: The Good, the Bad and the Ugly

#4
Even JSON is going to be "bloated". This cries out for a well-done, well-thought out binary format. While binary formats have certain disadvantages that never go away, a lot of the worst ones that we associate with them are the result of older standards that failed to contain enough extensibility. But there's a lot of good prior art to look at now. Heck, nowadays you could probably just define something as Protobuf (or your choice of similar standard, don't want to go too far into the weeds on the exact choice here) and be 95% of the way towards done.

Even just a linearization of most of SVG into the obvious layout, simply dropping any problematic features (script, XLink, namespace extensions) would probably be a pretty good start that you could churn out in a week as a prototype. You'd get an efficient binary format, an obvious mechanism for translating existing SVG into it (with equally obvious mechanisms for warning users about the existence of untranslated features in the output; also an easy mechanism for scanning sample SVGs and getting a statistical idea of how many fit into your new scheme), an obvious mechanism for translating your format back into SVG, and serialization support as cross-platform as your choice of serialization mechanism right out of the box. If this is your goal, this has a pretty hard to beat bang-for-the-buck.

Re: SVG: The Good, the Bad and the Ugly

#5
post #3

Article mentions svg supports tag... Coolest use of it: https://www.xul.fr/svgtetris.svg

Tetris in an SVG?!? I am in awe. I'm feeling equal parts: "this is beautiful", "this is perverse", and "I want to do this too"

Cool? Take a look at this: https://www.scriptol.fr/xml/code/invaders.svg

Re: SVG: The Good, the Bad and the Ugly

#7
post #4

Even JSON is going to be "bloated". This cries out for a well-done, well-thought out binary format. While binary formats have certain disadvantages that never go away, a lot of the worst ones that we associate with them are the result of older standards that failed to contain enough extensibility. But there's a lot of good prior art to look at now. Heck, nowadays you could probably just define something as Protobuf (…

> that failed to contain enough extensibility

Or too much abstraction and extensibility leading to excessive complexity!

Re: SVG: The Good, the Bad and the Ugly

#8
SVG is another chapter in the long and storied history of engineers attempting to the question, "How hard can 2D graphics be?" And if you look at the industry standard answers (from PostScript to AutoLisp to Gerber to SVG) the answer is, "pretty damn hard."

I don't know if you can slim down vector graphics successfully. Every SVG renderer in existence slims down SVG to some degree. The ones that do it the most are used the least because they can't sufficiently express the intent of the designer.

Re: SVG: The Good, the Bad and the Ugly

#10
My two gripes with SVG I bumped into (although the second one is more to browser implementations).

1. It doesn't support premultiplied alpha interpolation mode. If you ever import partially transparent rasterized images then it can cause visible artifacts at the edges of opaque regions.

2. Last time I checked no implementation supported interpolation in linear colorspace (linearRGB [1]).

So even though it's bloated it still misses features. And even though browsers are good fit for supporting it, they still don't bother implementing the full spec. And they implement PDF with vastly more gradient elements and color interpolation modes.

[1] https://www.w3.org/TR/SVG11/painting.html#ColorInterpolation...

Post reply on HN