Is SVG Cool?
By Peter A. Bromberg, Ph.D.
Printer - Friendly Version
Peter Bromberg

Is SVG Cool? (Does a bear go in the woods?) Let's face it, XML is cool, and SVG, which now has the W3C's imprimatur on it and which is Xml-based, is extremely cool.

If you aren't familiar with Scalable Vector Graphics language, take a short trip to the Adobe site and look at some of the demo samples - especially the animated ones. You'll have an opportunity to download and install Adobe's fine SVG viewer if you don't already have it (in fact you'll have no choice, since even IE 6.0 has no built-in SVG support):

http://www.adobe.com/svg/viewer/install/main.html

There are also several new books on SVG - I was asked to be a technical reviewer for one of the following that recently came out but I had to decline for lack of time. Samples:

http://www.oreilly.com/catalog/svgess/

http://www.amazon.com/exec/obidos/tg/detail/-/0672324296/103-6293679-4183029?vi=glance

http://www.amazon.com/exec/obidos/ASIN/0735711666/103-6293679-4183029

If you are interested in a pretty good "Get me started" type of tutorial on SVG, I'd recommend this one:

http://dhtmlnirvana.com/svg/

Meet the Problem…

The problem is Microsoft is so big, and controls so much of the desktop real estate, that sometimes they selfishly want to push their own little "dealies" to the exclusion of the emerging standards. In the case of SVG, it was MS's own VML (Vector Markup Language), which is pretty neat (see my article here about fractals in IE with VML script : http://www.eggheadcafe.com/articles/20010908.asp, and another about charting: from Prabhu: http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=290), but it's not the standard. For a while it looked like Microsoft was going to bring out VML 2.0, which handily borrowed from SVG but still was not going to be a supported standard.

As one newsgroup poster lamented, "I think Microsoft is a great company and I am grateful to them for bringing such basic innovations to this industry as graphical user interfaces, ethernet, object oriented programming, crash-proof operating systems, scalable fonts, etc. but if they don't support SVG I am going to have to re-adjust my opinion about them."

I think he left out the Internet, but you get the idea, and I agree (oh wait -sorry, that one was brought out by Al Gore). If MS decides to provide an integrated SVG viewer (ActiveX or whatever, similar to those for Flash and Shockwave), this would propel SVG farther than Adobe's "extra" 3+ MB downloadable viewer could even hope to do. MS owns your desktop, and when they decide to put something on it, that technology is guaranteed instant fame (more or less). Hence the big blowup about Sun wanting the Java runtime installed on all Windows OS's after MS yanked the only version they were allowed to have on there and threw it out the window (or should I say, "out the Windows"?). Sure, MS really wants to save people time so they don't have to download a 5MB install image over the Internet. They'll use every trick in the book to keep JRE off of Windows, especially since now we all need the extra space for the .NET runtime.

According to XML luminaries such as Kurt Cagle and others, one of the most recent indications that MS is indeed thinking about SVG is that it looks like Office 11's Visio will be supporting SVG for both import and export. This is pretty big news for a few different reasons. It is the first publicly stated endorsement that Microsoft has made to working with SVG in their own products, and the fact that it is going to be integrated at least to some degree into Office provides a significant boost to the prospect of SVG gaining ground. Now I don't have any "inside track" about this stuff at Microsoft; all I know is what I observe and what I like, and I've observed SVG for a while now and I am telling you it is good.

The integration with Visio makes a lot of sense. By being able to export into SVG, Visio could work effectively as a back-end system for shared program development, with SVG acting as a common web format for generating the visual front-end on multiple-platforms through the use of some form of ActiveX viewer or plugin. SVG is rapidly gaining ground as a tool for building process flow diagrams, mapping and other dynamic graphics.

Microsoft also has another angle with SVG. Corel announced an SVG Viewer similar to the Adobe SVG viewer, designed to be integrated into Microsoft's Tablet PC. I tried it in early March 2003 and it crashed on Adobe's sample page, so for now I'm sticking with the Adobe product; however the Corel offering looks like it more closely conforms with the W3C Recommendation.

Finally, it should be noted that the SVG 1.2 Working Draft was released from W3C last November. It looks like the standards gurus have been taking a breather for a while but with SVG, there is a lot to digest, so I would expect to see a lengthy gestation period for true SVG support to emerge. However, based on what I've seen so far, it should be well worth the wait.

New Products Coming

There is starting to be more support for SVG as the emerging standard in a number of products. One easy way to become familiar with it is to try JASC's (the PaintShop Pro people) "WebDraw" : http://www.jasc.com/products/webdraw/, which loads and saves in SVG format. You can also view and write SVG source code, validate the XML, work with regular bitmaps just as in Paint Shop Pro, and much more. It's kind of like Windows Paint for SVG on steroids.

Over the past year vendor support for SVG has moved forward. With the exception of Macromedia, many graphics vendors have shipped updated versions of products with support for SVG. Corel followed Adobe's Illustrator 10 with the release of Draw 11, which has extended support for SVG (including import and export). Other vendors have seen fit to make SVG the main theme of product offerings. PCX Software has pitched a suite of SVG-centric tools.

SharpVectorGraphics

Now for the real SVG treat that this article is all about: SharpVectorGraphics. SharpVectorGraphics, a Sourceforge - domiciled open source project (http://sourceforge.net/projects/svgdomcsharp), is a 100% managed code implementation of the SVG specification. The project is run by Don Kackman, Don_Xml, and Niklas Gustavsson; as with many Sourceforge -domiciled projects, you are welcome to join and contribute. The list of current project participants features some well-known names.

I played with the Alpha code SVG# & SVG.NET Viewer version 2.4, and found it to be highly robust. It even features Gzip compression via SharpZipLib.

Here is a 100% managed code implementation of the SVG specification including a complete DOM and Object Model for the CSS, RGBColor, all the interfaces such as IdocumentStyle, all the SVG Basic types, clipping and masking elements, Document structure elements, Gradients, Paths, Shapes -the works! Somebody spent a lot of time on this for no remuneration -- and they have done a first rate job, in my opinion.

On top of all the above, they've included a complete rendering engine and a SharpVector Viewer that lets you browse or load SVG stuff via Urls and has its own managed code custom svgPictureBox control!

Now of course you must understand that's ALPHA code and is filled with NotImplementedExceptions. If you are interested in C# and good programming practices, however, I'd strongly recommend downloading and reviewing the source code.

WIIFM -Is that your station?

What's In It For Me? Simple. With some new SVG -based object models like the one described above, and a self-installing ActiveX viewer, you can write dynamic reports and chart graphics that change dynamically online in the browser based on client-side user inputs.

The quality of your charts and graphics will be first -rate because we are dealing with vector, not raster graphics and lines. In addition, with the use of the svgz gzip -compressed format, your creations will stream over the wire as one of the most lightweight graphics formats in existence.

Make no mistake: SVG is big, and it will get a lot bigger-- soon. The only reason you aren't seeing more of it is because you have to download a third party plugin to view this cool stuff in your browser. Hopefully now that the MS people have started getting religion for standards, this will change.

Kudos to the SharpVector group and their fine work!


Peter Bromberg is a C# MVP, MCP, and .NET consultant who has worked in the banking and financial industry for 20 years. He has architected and developed web - based corporate distributed application solutions since 1995, and focuses exclusively on the .NET Platform.