|
From: Gary L. <gw...@so...> - 2007-03-09 18:01:17
|
A co-worker of mine had a question regarding anti-aliasing settings and = SLD files. I took a look through the GeoTools code base and haven=E2=80= =99t been able to answer him, and I was wondering if anyone here could p= oint me in the right direction. My co-worker is using an Ajax-based web browser application that request= s transparent GIF files using a WMS request to GeoServer. He uses these = GIF=E2=80=99s to create a sandwich of overlays, allowing the user to swi= tch between different combinations of images depending on what he wants = to see (some of the images are produced by data systems that are outside= scope of the GeoServer implementation). =20 Everything works fine except that the line and text graphics produced by= GeoServer are rendered with anti-aliasing. Now typically, when a graphi= cs environment draws a black line on a white background with anti-aliasi= ng, it will attempt to soften that saw-tooth effect that is sometimes vi= sible on angled lines by setting the color of pixels on or adjacent to t= he line to some intermediate color tone. Thus when my co-worker requests= an overlay of geopolitical outlines drawn in a rather dark color and th= e anti-aliasing in GeoServer assumes a white background, the transparent= GIF comes back with dark lines speckled with light gray dots. Of course= , he could just change the background, but even as a band-aid fix that d= oesn=E2=80=99t really work because sometimes he needs to sandwich images= on light background and sometimes he uses dark. If we adjust the SLD fi= les for light-colored lines on a dark background, we get a corresponding= unsightly effect. So the question: What=E2=80=99s the best way to suppress the anti-aliasi= ng effects=3F A couple of obvious ideas suggest themselves immediately, = but looking through the GeoTools code I don=E2=80=99t see any place wher= e they might be implemented (I haven=E2=80=99t looked through the GeoSer= ver code because I am still struggling to learn GeoTools, and don=E2=80= =99t think I could handle another challenge right now). I know that an a= pplication can suppress aliasing by using the java.awt.RenderingHints cl= ass, but I=E2=80=99m not sure how to get the proper values passed into G= eoTools. I thought that there might be a specification in the SLD format= to turn off aliasing, but I don=E2=80=99t see it in the OpenGIS documen= ts I=E2=80=99ve searched. An alternative approach might be to hack the G= eoServer code so that when a WMS request comes in for a transparent GIF,= it just turns off anti-aliasing=E2=80=A6 except that, first, I don=E2= =80=99t believe in doing that kind of non-standard stuff if it can be av= oided and, second, I don=E2=80=99t know where to begin to make the chang= e even if I concluded that was the only way to get the job done. Anyway, I apologize in advance if there=E2=80=99s an easy way of doing t= his and I=E2=80=99ve missed something obvious in the documentation. Than= ks for your help. Gary P.S. My co-worker has produced some sample images that do an admirable j= ob showing the anti-aliasing effect. If anyone is unfamiliar with the ef= fect and would like to see what it does, please let me know and I will s= end copies of the images. ------------------------------------------------------------------------= --------- Computer Science is the Art of the Possible Gary W. Lucas, Senior Software Engineer Sonalysts, Inc 215 Parkway North Waterford, CT 06320 (860) 326-3682 |