<div dir="ltr">Andreas,<div><br></div><div>I made that change in mapagg.cpp and it seems to do exactly what I need. Wunderbar!</div><div><br></div><div>As for providing an option to switch rasterizer based on an option, how about reviving the FORMATOPTION 'ANTIALIAS'?</div><div><br></div><div>Thanks, Erik</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 18, 2017 at 9:18 AM, Eichner, Andreas - SID <span dir="ltr"><<a href="mailto:Andreas.Eichner@sid.sachsen.de" target="_blank">Andreas.Eichner@sid.sachsen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nope, this won't work:<br>
<br>
  r->default_gamma = atof(msGetOutputFormatOption( format, "GAMMA", "0.75" ));<br>
  if(r->default_gamma <= 0.0 || r->default_gamma >= 1.0) {<br>
    r->default_gamma = 0.75;<br>
  }<br>
<br>
>From mapagg.cpp lines 844-847 forces 0 < GAMMA < 1<br>
Also note that MapServer uses a linear gamma function defined as<br>
<br>
       double operator() (double x) const<br>
        {<br>
            if(x < m_start) return 0.0;<br>
            if(x > m_end) return 1.0;<br>
            return (x - m_start) / (m_end - m_start);<br>
        }<br>
<br>
Where m_start is _always_ set to 0 and m_end is set to the GAMMA value given by you (or the default 0.75).<br>
I think someone should check this - to me it seems a power function was intented...<br>
<br>
HTH<br>
<span class=""><br>
> -----Ursprüngliche Nachricht-----<br>
> Von: mapserver-users [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-<wbr>bounces@lists.osgeo.org</a>] Im<br>
</span>> Auftrag von <a href="mailto:lars.schylberg@blixtmail.se">lars.schylberg@blixtmail.se</a><br>
> Gesendet: Mittwoch, 18. Oktober 2017 14:05<br>
> An: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
<span class="im HOEnZb">> Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<br>
><br>
> Hi,<br>
><br>
><br>
><br>
><br>
</span><div class="HOEnZb"><div class="h5">> I did some quick tests with :<br>
><br>
><br>
><br>
><br>
>   OUTPUTFORMAT<br>
>     NAME "png_G0"<br>
>     DRIVER AGG/PNG<br>
>     MIMETYPE "image/png"<br>
>     IMAGEMODE RGB<br>
>     EXTENSION "png"<br>
>     FORMATOPTION "GAMMA=0.0"<br>
>   END<br>
><br>
><br>
><br>
><br>
> and shp2img with options -i<br>
><br>
><br>
> eg: shp2img -m 01_polygon_td_poly.map -o 01_polygon_td_poly.png -i<br>
> png_G0<br>
><br>
><br>
><br>
><br>
><br>
> I did some tests with both polygons, polygon outlines and lines and they<br>
> all seems to have anti-aliasing as far as I could see.<br>
><br>
> Would this be an ok way to test it?  I also have some people that would<br>
> like to do lines without anti-aliasing for a strange reason.<br>
><br>
><br>
><br>
><br>
><br>
> Lars Schylberg<br>
><br>
><br>
><br>
><br>
><br>
> -----Originalmeddelande-----<br>
> > Från: "Rahkonen Jukka (MML)" <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@<wbr>maanmittauslaitos.fi</a>><br>
> > Till: "Eichner, Andreas - SID" <<a href="mailto:Andreas.Eichner@sid.sachsen.de">Andreas.Eichner@sid.sachsen.<wbr>de</a>>, "Erik<br>
> H" <<a href="mailto:erik.h11.01@gmail.com">erik.h11.01@gmail.com</a>><br>
> > Kopia: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > Datum: 2017-10-18 11:13<br>
> > Ämne: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<br>
> ><br>
> > Hi,<br>
> ><br>
> > I suppose that the amount of antialiasing with AGG is set with "gamma"<br>
> parameter.  Mapserver supports that at least for polygons as documented<br>
> in <a href="http://www.mapserver.org/mapfile/outputformat.html" rel="noreferrer" target="_blank">http://www.mapserver.org/<wbr>mapfile/outputformat.html</a> but you could try<br>
> if using gamma=0.0 has an effect on lines as well. It may be that it<br>
> does not because search<br>
> ><br>
> <a href="https://github.com/mapserver/mapserver/search?utf8=%E2%9C%93&q=gamma&typ" rel="noreferrer" target="_blank">https://github.com/mapserver/<wbr>mapserver/search?utf8=%E2%9C%<wbr>93&q=gamma&typ</a><br>
> e=<br>
> > seems to find only something that is tied to polygon outlines<br>
> > <a href="https://github.com/mapserver/mapserver/blob/branch-7-" rel="noreferrer" target="_blank">https://github.com/mapserver/<wbr>mapserver/blob/branch-7-</a><br>
> 0/renderers/agg/include/agg_<wbr>renderer_outline_aa.h<br>
> ><br>
> ><br>
> > If gamma does not work for lines then it could be worth making a<br>
> feature request for adding a new formatoption "GAMMA_LINE=[].<br>
> ><br>
> > Couple of Mapnik links dealing with the same issue:<br>
> > <a href="http://gis.19327.n8.nabble.com/Turning-off-anti-aliasing-" rel="noreferrer" target="_blank">http://gis.19327.n8.nabble.<wbr>com/Turning-off-anti-aliasing-</a><br>
> td5339458.html<br>
> > <a href="http://mapnik.org/mapnik-reference/#3.0.6/line-gamma-method" rel="noreferrer" target="_blank">http://mapnik.org/mapnik-<wbr>reference/#3.0.6/line-gamma-<wbr>method</a><br>
> ><br>
> > -Jukka Rahkonen-<br>
> ><br>
> ><br>
> ><br>
> > -----Alkuperäinen viesti-----<br>
> > Lähettäjä: mapserver-users [mailto:<a href="mailto:mapserver-users-">mapserver-users-</a><br>
> <a href="mailto:bounces@lists.osgeo.org">bounces@lists.osgeo.org</a>] Puolesta Eichner, Andreas - SID<br>
> > Lähetetty: 18. lokakuuta 2017 9:57<br>
> > Vastaanottaja: Erik H <<a href="mailto:erik.h11.01@gmail.com">erik.h11.01@gmail.com</a>><br>
> > Kopio: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > Aihe: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<br>
> ><br>
> > Damn... missed attaching the images.<br>
> ><br>
> > > -----Ursprüngliche Nachricht-----<br>
> > > Von: mapserver-users [mailto:<a href="mailto:mapserver-users-">mapserver-users-</a><br>
> <a href="mailto:bounces@lists.osgeo.org">bounces@lists.osgeo.org</a>]<br>
> > > Im Auftrag von Eichner, Andreas - SID<br>
> > > Gesendet: Mittwoch, 18. Oktober 2017 08:28<br>
> > > An: Erik H<br>
> > > Cc: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > > Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<br>
> > ><br>
> > > Hi,<br>
> > ><br>
> > > I just meant that it seems to be pretty easy to implement aliased<br>
> > > rendering with AGG.<br>
> > > Simply changing the typedef in line 91 of mapagg.cpp from<br>
> > ><br>
> > >   typedef mapserver::renderer_scanline_<wbr>aa_solid<renderer_base><br>
> > > renderer_scanline;<br>
> > ><br>
> > > to<br>
> > ><br>
> > >   typedef mapserver::renderer_scanline_<wbr>bin_solid<renderer_base><br>
> > > renderer_scanline;<br>
> > ><br>
> > > turns of anti-aliased rendering. I've attached the output of<br>
> "shp2img<br>
> > > -m line_simple.map" from the msautotests.<br>
> > > An additional member in class AGG2Renderer for the aliased<br>
> rasterizer<br>
> > > and conditionally passing one or the other to render_scanlines()<br>
> > > depending on some value of strokeStyleObj might be enough.<br>
> > ><br>
> > > Regards<br>
> > ><br>
> > > > -----Ursprüngliche Nachricht-----<br>
> > > > Von: Erik H [mailto:<a href="mailto:erik.h11.01@gmail.com">erik.h11.01@gmail.com</a>]<br>
> > > > Gesendet: Dienstag, 17. Oktober 2017 17:34<br>
> > > > An: Eichner, Andreas - SID<br>
> > > > Cc: Richard Greenwood; <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > > > Betreff: Re: [mapserver-users] Draw roads WITHOUT anti-aliasing<br>
> > > ><br>
> > > > As for Andreas' remark about 'simply the use of another scanline<br>
> > > > rasterizer.' - I'm sorry but I'm not much of a C++ developer. If I<br>
> > > have<br>
> > > > to do rasterizing, I'd skip MapServer altogether and generate the<br>
> > > > PNG<br>
> > > in<br>
> > > > Java.<br>
> > > ><br>
> > > ______________________________<wbr>_________________<br>
> > > mapserver-users mailing list<br>
> > > <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > > <a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/mapserver-<wbr>users</a><br>
> > ______________________________<wbr>_________________<br>
> > mapserver-users mailing list<br>
> > <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
> > <a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/mapserver-<wbr>users</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
><br>
><br>
______________________________<wbr>_________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.<wbr>org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/mapserver-<wbr>users</a></div></div></blockquote></div><br></div>