D could catch this wave: web assembly

Wyatt via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 19 09:22:58 PDT 2015


On Friday, 19 June 2015 at 14:47:10 UTC, Ola Fosheim Grøstad 
wrote:
> On Friday, 19 June 2015 at 14:18:49 UTC, Wyatt wrote:
>
> Do you guys have any real arguments against SVG? It is 
> currently the most useful interchangeformat for 2D vector 
> graphics.

You want reasons I dislike SVG?  I can address a few different 
levels.

It's unbelievably complex even if you reduce it to just the 
still-graphics parts.  This means implementing a renderer it is 
not even close to trivial (you need to support a huge chunk of 
CSS, for one thing) and rendering consistency is difficult to get 
right even in fairly simple situations.[1]  Fill rules, path 
joining, stroke scaling, markers, filters, paint order, the list 
goes on.  It's very byzantine.

It's DOM-based anyway, which means you can't reasonably expect 
good performance when manipulating it in an editor (it only pays 
lip-service to the concept of "human readable", so you really 
NEED an editor) or memory requirements.  Even just rendering it 
for output on a device has poor performance (I don't even know if 
Nvidia has even bothered putting more work into their OpenGL 
extension for 2D vectors).  Even relatively simple animations in 
SVG can peg a CPU core.

It only supports linear gradients, which makes it basically 
useless for artistic work unless you live in a "Modern" bubble.  
There's no support for variable stroke width.  You can only 
define one stroke and one fill, so if you want to composite those 
things, you need to do a lot of duplication.  On top of that, 
blending can only be done through filters (which are milquetoast 
at best).  And text in SVG is...ugh, let's not even start.


SVG is somewhat useful if you only need simple diagrams with 
solid colours and you don't trust PNG for some reason.

-Wyatt

[1] http://tavmjong.free.fr/blog/?p=1257


More information about the Digitalmars-d mailing list