[mapserver-commits] r11956 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Jul 19 07:06:49 EDT 2011
Author: tbonfort
Date: 2011-07-19 04:06:48 -0700 (Tue, 19 Jul 2011)
New Revision: 11956
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapagg.cpp
Log:
Add gamma correction to AGG polygon rendering (#3165)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-07-19 05:14:57 UTC (rev 11955)
+++ trunk/mapserver/HISTORY.TXT 2011-07-19 11:06:48 UTC (rev 11956)
@@ -14,6 +14,7 @@
Current Version (SVN trunk, 6.1-dev, future 6.2):
-------------------------------------------------
+- Add gamma correction to AGG polygon rendering (#3165)
- Initialize the scalebar image color to transparent by default (#3957)
Modified: trunk/mapserver/mapagg.cpp
===================================================================
--- trunk/mapserver/mapagg.cpp 2011-07-19 05:14:57 UTC (rev 11955)
+++ trunk/mapserver/mapagg.cpp 2011-07-19 11:06:48 UTC (rev 11956)
@@ -52,6 +52,7 @@
#include "renderers/agg/include/agg_font_freetype.h"
#include "renderers/agg/include/agg_conv_contour.h"
#include "renderers/agg/include/agg_ellipse.h"
+#include "renderers/agg/include/agg_gamma_functions.h"
#include "renderers/agg/include/agg_scanline_boolean_algebra.h"
#include "renderers/agg/include/agg_scanline_storage_aa.h"
@@ -145,6 +146,7 @@
rasterizer_outline m_rasterizer_primitives;
#endif
rasterizer_scanline m_rasterizer_aa;
+ rasterizer_scanline m_rasterizer_aa_gamma;
mapserver::scanline_p8 sl_poly; /*packed scanlines, works faster when the area is larger
than the perimeter, in number of pixels*/
mapserver::scanline_u8 sl_line; /*unpacked scanlines, works faster if the area is roughly
@@ -248,11 +250,11 @@
int agg2RenderPolygon(imageObj *img, shapeObj *p, colorObj * color) {
AGG2Renderer *r = AGG_RENDERER(img);
polygon_adaptor polygons(p);
- r->m_rasterizer_aa.reset();
- r->m_rasterizer_aa.filling_rule(mapserver::fill_even_odd);
- r->m_rasterizer_aa.add_path(polygons);
+ r->m_rasterizer_aa_gamma.reset();
+ r->m_rasterizer_aa_gamma.filling_rule(mapserver::fill_even_odd);
+ r->m_rasterizer_aa_gamma.add_path(polygons);
r->m_renderer_scanline.color(aggColor(color));
- mapserver::render_scanlines(r->m_rasterizer_aa, r->sl_poly, r->m_renderer_scanline);
+ mapserver::render_scanlines(r->m_rasterizer_aa_gamma, r->sl_poly, r->m_renderer_scanline);
return MS_SUCCESS;
}
@@ -709,6 +711,10 @@
r->m_pixel_format.attach(r->m_rendering_buffer);
r->m_renderer_base.attach(r->m_pixel_format);
r->m_renderer_scanline.attach(r->m_renderer_base);
+ double gamma = atof(msGetOutputFormatOption( format, "GAMMA", "0.75" ));
+ if(gamma > 0.0 && gamma < 1.0) {
+ r->m_rasterizer_aa_gamma.gamma(mapserver::gamma_linear(0.0,gamma));
+ }
if( bg && !format->transparent )
r->m_renderer_base.clear(aggColor(bg));
else
More information about the mapserver-commits
mailing list