Home/
  News     Docs     Download     Mailing List     SVN  

A Simple SVG Viewer

The SVG viewer is just another example of using Anti-Grain Geometry. AGG is a vector graphics renderer for C++. See Main Page for details. The viewer supports absolute minimum of the SVG specification, it basically can be used as a simple example of AGG plus SVG. But of course, its functionality can be extended. The main point of the viewer is high quality and high performance. The Anti-Aliasing algorithm produces 256 levels of transparency. Actually, AGG computes the exact coverage of the outline on each pixel cell.

Besides, the viewer has a very nice feature that I haven't seen in any other ones. It's eliminating of the "problem of adjacent edges". It appears when rendering adjacent polygons with anti-aliasing and looks like thin "web" upon the image. Strictly speaking, it's possible to get rid of it completely only when the polygons are fully opaque. When they are translucent, the effect will appear anyway. However, it's possible to reduce the effect so that it becomes almost invisible.

In the AGG SVG Viewer you can control this problem changing the Anti-Aliasing gamma (see Gamma Correction) and the value of dilation of the polygons. Anti-Grain Geometry provides a simple “contour” tool that can dilate or shrink the polygons. This tool can also be used to change the font weight on the fly, for example. The following picture illustrates the result of eliminating the adjacent edges problem.


Comparison of the quality of the Adobe SVG Viewer and AGG



See also an animated GIF.

You can download a precompiled executable for Windows: svg_test (svg_test.zip) and some SVG examples: svg_examples (svg_examples.zip)

The sources are in the distribution package that you can get at the Download page. The directory name is “svg”. The library can be compiled with Microsoft Visual C++ v6.0 or above, as well as with GNU C++ or other modern compilers. The viewer uses the Win32 API on Windows and X11 on Unix and Linux. You will also need the Expat XML Parser to build the viewer.

Below there are some more AGG SVG Viewer screenshots.





Copyright © 2002-2006 Maxim Shemanarev
Web Design and Programming Maxim Shemanarev