[mapserver-commits] r10155 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed May 12 23:30:24 EDT 2010


Author: sdlime
Date: 2010-05-12 23:30:23 -0400 (Wed, 12 May 2010)
New Revision: 10155

Modified:
   trunk/mapserver/mapgd2.c
Log:
Added gd2 tiled fill support...

Modified: trunk/mapserver/mapgd2.c
===================================================================
--- trunk/mapserver/mapgd2.c	2010-05-13 02:15:29 UTC (rev 10154)
+++ trunk/mapserver/mapgd2.c	2010-05-13 03:30:23 UTC (rev 10155)
@@ -66,7 +66,7 @@
   gdImagePtr ip;
 
   if(!img || !fp) return MS_FAILURE;
-  ip = MS_IMAGE_GET_GDIMAGEPTR(img);
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
 
   if(strcasecmp("ON", msGetOutputFormatOption(format, "INTERLACE", "ON")) == 0)
     gdImageInterlace(ip, 1);
@@ -141,7 +141,9 @@
 
 /*
 ** Polygon fill. Based on "Concave Polygon Scan Conversion" by Paul
-** Heckbert from "Graphics Gems", Academic Press, 1990 
+** Heckbert from "Graphics Gems", Academic Press, 1990.
+**
+** TODO: do we need the offsets?
 */
 static void imageFilledPolygon(gdImagePtr im, shapeObj *p, int c, int offsetx, int offsety)
 {
@@ -310,7 +312,7 @@
   int c;
 
   if(!img || !p || !stroke) return;
-  ip = MS_IMAGE_GET_GDIMAGEPTR(img);
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return;
 
   if(stroke->color.pen == MS_PEN_UNSET) setPen(ip, &stroke->color);
   c = stroke->color.pen;
@@ -355,7 +357,7 @@
   gdImagePtr ip;
 
   if(!img || !p || !color) return;
-  ip = MS_IMAGE_GET_GDIMAGEPTR(img);
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return;
   if(color->pen == MS_PEN_UNSET) setPen(ip, color);
   imageFilledPolygon(ip, p, color->pen, 0, 0);
 }
@@ -381,7 +383,15 @@
 void renderTileGD(imageObj *img, imageObj *tile, double x, double y) {
 }
 
-void renderPolygonTiledGD(imageObj *img, shapeObj *p,  imageObj *tile) {
+void renderPolygonTiledGD(imageObj *img, shapeObj *p,  imageObj *tile) 
+{
+  gdImagePtr ip, tp;
+
+  if(!img || !p || !tile) return;
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return;
+  if(!(tp = MS_IMAGE_GET_GDIMAGEPTR(tile))) return;
+  gdImageSetTile(ip, tp);
+  imageFilledPolygon(ip, p, gdTiled, 0, 0);  
 }
 
 /*



More information about the mapserver-commits mailing list