All,<br><br>Some of you may find this useful....<br><br>I've been looking into ways of creating antialised GrADS images which
do not have those distracting horizontal lines into them. After several
hacks which were too slow to meet my real time requirements (including
a metafile translator based on the ImageMagick API) I ended up using
the Cairo Vector Graphics Library:
<br><br> <a href="http://cairographics.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://cairographics.org/</a><br><br>to write yet another gx translator: gxyat.c (see source and gxyat.1
man page attached). Cairo is being used by many
big projects such as gtk and firefox and it is very simple to use. This translator produces PNG, SVG, PS or PDF, although I'd still recommend Matt's gxeps for postscript output. <br><br>Sorry, but I am not providing binaries, just the attached sources. Details on building gxyat and comparison to other translators are bellow.
<br><br> Enjoy,<br><br> Arlindo<br><br><br>1) Building gxyat<br><br>To build gxyat, first build cairo. I'd suggest grabbing the
latest v1.4.6 tarball from the site above and doing configure+make.
Don't worry if it cannot find freetype or any font related dependency
as GrADS draws its own fonts. Cairo is amazingly self-contained for a
package of this nature. I have easily built cairo on Linux and on my G5
laptop running Mac OS/X 10.4; it also builds natively on Windows, and
pre-compiled libcairo.dll are available (I have done this yet). Once you have cairo, building
gxyat is trivial:<br>
<br>
% gcc -o gxyat -I/usr/local/include/cairo
gxyat.c -L/usr/local/lib -lcairo<br>
<br>
Type
'gxyat' for a man page (see gxyat.1 attached) and try the examples.
When running it, make sure it finds the libcairo.so you just built, not
the one in /usr/lib. Although this usually works, in one case I got a
float point exception when an ancient version of cairo was already
installed on my system. To check which .so's are being seen, type "ldd
gxyat", and set LD_LIBRARY_PATH if you need to.
On Mac OS X you set DYLD_LIBRRAY_PATH instead - how annoying!<br><br>2) Comparison to other translators<br><br>I am attaching some GrADS images generated with various translators for comparison. The built in <span id="st" name="st" class="st">
printim</span>
is fast but has the poorest quality, particularly the fonts; I suspect
one of its problems may the integer arithmetic in the reimplemented
line drawing code (I had a similar quality problem in gximg until I
switched some of the coordinate variables to double). <br><br>One alternative
to have smoother fonts is to go through gm->eps->png using
convert, which in turn uses ghostscript to render the image; the
result is file "
ghostscript.png" which has the now classic horizontal lines due to
"fringing" in the antialiasing algorithm; this process is also slow.
The file gxyat.png was produced with the new utility; there I draw all
lines with anti-aliasing on, but turn it off when doing color fills.
Because anti-aliasing usually makes the lines wider, any potential
mismatch between shaded contours and contour lines is hardly noticeable
(specially if you are 40 or older :-). The new utility is also very
fast. As a bonus, one is also able to create PS, PDF and Scalar Vector
Graphics (SVG). The latter is a W3C specification and has native
support in firefox since v1.5 (IE still needs a plugin from Adobe). SVG
also allows you to use vector editors such as Adobe illustrator or
Inkscape on Linux to embelish your images, yet keeping it fully
scalable. I'd think that GIS applications would support SVG as well,
but I have no experience with these. SVG is growing on me. The PDF
option can also be handy to e-mail someone a whole batch of images in a
single file.
I'd stick with gxeps for postscript at this point.<br><br><br>-- <br>Arlindo da Silva<br><a href="mailto:dasilva@alum.mit.edu">dasilva@alum.mit.edu</a>