[mapserver-commits] r9088 - sandbox/davidK

svn at osgeo.org svn at osgeo.org
Sat Jun 6 02:35:10 EDT 2009


Author: davidK
Date: 2009-06-06 02:35:07 -0400 (Sat, 06 Jun 2009)
New Revision: 9088

Modified:
   sandbox/davidK/mapcairo.c
   sandbox/davidK/mapdraw.c
   sandbox/davidK/mapkml.cpp
   sandbox/davidK/mapkmlrenderer.cpp
   sandbox/davidK/mapkmlrenderer.h
   sandbox/davidK/mapogl.cpp
   sandbox/davidK/mapserver.h
Log:


Modified: sandbox/davidK/mapcairo.c
===================================================================
--- sandbox/davidK/mapcairo.c	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapcairo.c	2009-06-06 06:35:07 UTC (rev 9088)
@@ -689,15 +689,22 @@
 
 
 
-void startNewLayerCairo(imageObj *img, double opacity) {
-	cairo_renderer *r = getCairoRenderer(img);
-	cairo_push_group (r->cr);
+void startNewLayerCairo(imageObj *img, layerObj *layer) {
+	if (layer->opacity > 0 && layer->opacity < 100)
+	{
+		cairo_renderer *r = getCairoRenderer(img);
+		cairo_push_group (r->cr);
+	}
 }
 
-void closeNewLayerCairo(imageObj *img, double opacity) {
-	cairo_renderer *r = getCairoRenderer(img);
-	cairo_pop_group_to_source (r->cr);
-	cairo_paint_with_alpha (r->cr, opacity);
+void closeNewLayerCairo(imageObj *img, layerObj *layer) {
+	if (layer->opacity > 0 && layer->opacity < 100)
+	{
+		double opacity = layer->opacity * 0.01;
+		cairo_renderer *r = getCairoRenderer(img);
+		cairo_pop_group_to_source (r->cr);
+		cairo_paint_with_alpha (r->cr, opacity);
+	}
 }
 
 

Modified: sandbox/davidK/mapdraw.c
===================================================================
--- sandbox/davidK/mapdraw.c	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapdraw.c	2009-06-06 06:35:07 UTC (rev 9088)
@@ -720,10 +720,10 @@
 							"msDrawLayer()");
 					return (MS_FAILURE);
 				}
-			} else {
-				image_draw->format->r->startNewLayer(image_draw,layer->opacity);
 			}
 		} 
+
+		image_draw->format->r->startNewLayer(image_draw, layer);
   }
 #ifdef USE_AGG
   else if(MS_RENDERER_AGG(image_draw->format)) {
@@ -790,18 +790,22 @@
     /* deref and possibly free temporary transparent output format.  */
     msApplyOutputFormat( &transFormat, NULL, MS_NOOVERRIDE, MS_NOOVERRIDE, MS_NOOVERRIDE );
   }
-  else if( MS_RENDERER_PLUGIN(image_draw->format) && layer->opacity > 0 && layer->opacity < 100 ) {
-	  if (!image_draw->format->r->supports_transparent_layers) {
-          rasterBufferObj rb;
-          image_draw->format->r->getRasterBuffer(image_draw,&rb);
+  else if( MS_RENDERER_PLUGIN(image_draw->format))
+  {
+	if (layer->opacity > 0 && layer->opacity < 100)
+	{
+		if (!image_draw->format->r->supports_transparent_layers) {
+		  rasterBufferObj rb;
+		  image_draw->format->r->getRasterBuffer(image_draw,&rb);
 		  image_draw->format->r->mergeRasterBuffer(image,&rb,layer->opacity*0.01,0,0);  
 		  image_draw->format->r->freeImage( image_draw );
-	
+
 		  /* deref and possibly free temporary transparent output format.  */
 		  msApplyOutputFormat( &transFormat, NULL, MS_NOOVERRIDE, MS_NOOVERRIDE, MS_NOOVERRIDE );
-	  } else {
-		  image_draw->format->r->closeNewLayer(image_draw,layer->opacity*0.01);
-	  }
+		}
+	}
+
+	image_draw->format->r->closeNewLayer(image_draw, layer);
   }
 #ifdef USE_AGG
   else if( MS_RENDERER_AGG(image_draw->format) && layer->opacity > 0 && layer->opacity < 100 ) {

Modified: sandbox/davidK/mapkml.cpp
===================================================================
--- sandbox/davidK/mapkml.cpp	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapkml.cpp	2009-06-06 06:35:07 UTC (rev 9088)
@@ -122,16 +122,16 @@
 	return MS_FALSE;
 }
 
-void msStartNewLayerKml(imageObj *img, double opacity)
+void msStartNewLayerKml(imageObj *img, layerObj *layer)
 {
 	KmlRenderer* renderer = getKmlRenderer(img);
-	renderer->startNewLayer(img, opacity);
+	renderer->startNewLayer(img, layer);
 }
 
-void msCloseNewLayerKml(imageObj *img, double opacity)
+void msCloseNewLayerKml(imageObj *img, layerObj *layer)
 {
 	KmlRenderer* renderer = getKmlRenderer(img);
-	renderer->closeNewLayer(img, opacity);
+	renderer->closeNewLayer(img, layer);
 }
 
 void msTransformShapeKml(shapeObj *shape, rectObj extend, double cellsize)

Modified: sandbox/davidK/mapkmlrenderer.cpp
===================================================================
--- sandbox/davidK/mapkmlrenderer.cpp	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapkmlrenderer.cpp	2009-06-06 06:35:07 UTC (rev 9088)
@@ -69,7 +69,7 @@
 {
 }
 
-void KmlRenderer::startNewLayer(imageObj *img, double opacity)
+void KmlRenderer::startNewLayer(imageObj *img, layerObj *layer)
 {
 	LayerNode = xmlNewChild(RootNode, NULL, BAD_CAST "Folder", NULL);
 	xmlAddChild(RootNode, LayerNode);
@@ -84,7 +84,7 @@
 	xmlNodeAddContent(layerDescriptionNode, BAD_CAST "layer desc...");
 }
 
-void KmlRenderer::closeNewLayer(imageObj *img, double opacity)
+void KmlRenderer::closeNewLayer(imageObj *img, layerObj *layer)
 {
 	
 }

Modified: sandbox/davidK/mapkmlrenderer.h
===================================================================
--- sandbox/davidK/mapkmlrenderer.h	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapkmlrenderer.h	2009-06-06 06:35:07 UTC (rev 9088)
@@ -24,8 +24,8 @@
     int saveImage(imageObj *img, FILE *fp, outputFormatObj *format);
     void freeImage(imageObj *image);
     
-	void startNewLayer(imageObj *img, double opacity);
-	void closeNewLayer(imageObj *img, double opacity);
+	void startNewLayer(imageObj *img, layerObj *layer);
+	void closeNewLayer(imageObj *img, layerObj *layer);
 
 	void renderLine(imageObj *img, shapeObj *p, strokeStyleObj *style);
 	void renderPolygon(imageObj *img, shapeObj *p, colorObj *color);

Modified: sandbox/davidK/mapogl.cpp
===================================================================
--- sandbox/davidK/mapogl.cpp	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapogl.cpp	2009-06-06 06:35:07 UTC (rev 9088)
@@ -201,12 +201,13 @@
 	img->img.plugin=NULL;
 }
 
-void msStartNewLayerOgl(imageObj *img, double opacity)
+void msStartNewLayerOgl(imageObj *img, layerObj *layer)
 {
-	getOglRenderer(img)->setTransparency(opacity/100);
+	double opacity = layer->opacity/100;
+	getOglRenderer(img)->setTransparency(opacity);
 }
 
-void msCloseNewLayerOgl(imageObj *img, double opacity)
+void msCloseNewLayerOgl(imageObj *img, layerObj *layer)
 {
 	getOglRenderer(img)->setTransparency(1.0);
 }

Modified: sandbox/davidK/mapserver.h
===================================================================
--- sandbox/davidK/mapserver.h	2009-06-06 00:09:05 UTC (rev 9087)
+++ sandbox/davidK/mapserver.h	2009-06-06 06:35:07 UTC (rev 9088)
@@ -2517,8 +2517,8 @@
     		rectObj *rect, double **advances);
 void msFreeImageOgl(imageObj *image);
 void msFreeTileOgl(void *tile);
-void msStartNewLayerOgl(imageObj *img, double opacity);
-void msCloseNewLayerOgl(imageObj *img, double opacity);
+void msStartNewLayerOgl(imageObj *img, layerObj *layer);
+void msCloseNewLayerOgl(imageObj *img, layerObj *layer);
 void msFreeSymbolOgl(symbolObj *s);
 
 #endif /* SWIG */
@@ -2553,8 +2553,8 @@
         		rectObj *rect, double **advances);
     void freeImageCairo(imageObj *image);
     void freeTileCairo(imageObj *tile);
-    void startNewLayerCairo(imageObj *img, double opacity);
-    void closeNewLayerCairo(imageObj *img, double opacity);
+    void startNewLayerCairo(imageObj *img, layerObj *layer);
+    void closeNewLayerCairo(imageObj *img, layerObj *layer);
     void freeSymbolCairo(symbolObj *s);
 #endif /* SWIG */
 #endif
@@ -2642,8 +2642,8 @@
     int (*getTruetypeTextBBox)(imageObj *img,char *font, double size, char *string,
     		rectObj *rect, double **advances);
     
-	void (*startNewLayer)(imageObj *img, double opacity);
-	void (*closeNewLayer)(imageObj *img, double opacity);
+	void (*startNewLayer)(imageObj *img, layerObj *layer);
+	void (*closeNewLayer)(imageObj *img, layerObj *layer);
 	
     void (*transformShape)(shapeObj *shape, rectObj extend, double cellsize);
     void (*freeImage)(imageObj *image);



More information about the mapserver-commits mailing list