I was looking for a compact, binary format for simple vector graphics.
I didn't find one that did all I wanted.

SVG is the de facto standard for vector graphics, in the open source
world. Unfortunately, https://www.w3.org/TR/SVG/single-page.html
prints as 400 pages, not including the XML, CSS or XSLT
specifications. The S in SVG doesn't stand for simple.

The Haiku Vector Icon Format is pretty close. Unfortunately, I didn't
find a written specification, only a single C implementation, tightly
coupled, as far as I could tell, to the Haiku operating system. Also,
https://www.haiku-os.org/articles/2009-09-14_why_haiku_vector_icons_are_so_small
says that "you wouldn't really want to use HVIF to store generic
vector graphics".

OpenType fonts contain vector graphics (glyphs), and people use it for
icon and emoji fonts. Unfortunately, there doesn't appear to be a
clear standard for colored or partially transparent glyphs.
https://en.wikipedia.org/wiki/OpenType#Color lists three competing
approaches, built on PNG, SVG or neither.

So, as an experiment, I invented a new format: IconVG. The format
itself is documented at
https://godoc.org/golang.org/x/exp/shiny/iconvg and there are some
examples at https://go.googlesource.com/exp/+/master/shiny/iconvg/testdata

The Material Design icon set (https://design.google.com/icons/)
consists of 961 vector icons. As SVG files, this totals 312,887 bytes.
As 24*24 pixel PNGs, 190,840 bytes. As 48*48 pixel PNGs, 318,219
bytes. As IconVGs, 122,012 bytes.

Like all of the golang.org/x/exp/shiny code, this is experimental, but
I think that IconVG is at an interesting enough point now to share.

The vector rasterizer at golang.org/x/image/vector is also a nice Go
package, in my biased opinion, based on the algorithm described at
https://medium.com/@raphlinus/inside-the-fastest-font-renderer-in-the-world-75ae5270c445#.ja3y3m6z2,
but that's probably a different topic for a different time.

Comments welcome.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to