[mapserver-commits] r9868 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Mon Feb 22 17:08:55 EST 2010


Author: sdlime
Date: 2010-02-22 17:08:55 -0500 (Mon, 22 Feb 2010)
New Revision: 9868

Modified:
   trunk/mapserver/Makefile.in
   trunk/mapserver/mapgd2.c
Log:
Added mapgd2.o to the Makefile...

Modified: trunk/mapserver/Makefile.in
===================================================================
--- trunk/mapserver/Makefile.in	2010-02-22 22:07:52 UTC (rev 9867)
+++ trunk/mapserver/Makefile.in	2010-02-22 22:08:55 UTC (rev 9868)
@@ -277,7 +277,7 @@
 
 RM= /bin/rm -f
 
-OBJS= $(AGG_OBJ) mapogl.o mapoglrenderer.o mapoglcontext.o mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapagg.o mapagg2.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o  mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o mapxml.o $(EPPL_OBJ) 
+OBJS= $(AGG_OBJ) mapogl.o mapoglrenderer.o mapoglcontext.o mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapgd2.o mapagg.o mapagg2.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o  mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o mapxml.o $(EPPL_OBJ) 
 
 EXE_LIST = 	shp2img shp2pdf legend mapserv shptree shptreevis \
 		shptreetst scalebar sortshp mapscriptvars tile4ms \

Modified: trunk/mapserver/mapgd2.c
===================================================================
--- trunk/mapserver/mapgd2.c	2010-02-22 22:07:52 UTC (rev 9867)
+++ trunk/mapserver/mapgd2.c	2010-02-22 22:08:55 UTC (rev 9868)
@@ -44,15 +44,49 @@
 /*
 ** GD driver-specific image handling functions.
 */
-imageObj *createImageGD(int width, int height, outputFormatObj *format, colorObj* bg) {
-  return NULL;
+imageObj *createImageGD(int width, int height, outputFormatObj *format, colorObj* bg) 
+{
+  imageObj *img = NULL;
+  gdImagePtr ip;
+
+  img = (imageObj *) calloc(1, sizeof (imageObj));
+
+  /* we're only doing PC256 for the moment */
+  ip = gdImageCreate(width, height);
+  gdImageColorAllocate(ip, bg->red, bg->green, bg->blue); /* set the background color */
+
+  img->img.plugin = (void *) ip;
+  return img;
 }
 
-int saveImageGD(imageObj *img, FILE *fp, outputFormatObj *format) {
+int saveImageGD(imageObj *img, FILE *fp, outputFormatObj *format) 
+{
+  gdImagePtr ip;
+
+  if(!img || !fp) return NULL;
+  ip = (gdImagePtr) img->img.plugin;
+
+  if(strcasecmp("ON", msGetOutputFormatOption(format, "INTERLACE", "ON")) == 0)
+    gdImageInterlace(ip, 1);
+
+  if(format->transparent)
+    gdImageColorTransparent(ip, 0);
+
+  if(strcasecmp(format->driver, "gd2/gif") == 0)
+    gdImageGif(ip, fp);
+  else if(strcasecmp(format->driver, "gd2/png") == 0)
+    gdImagePng(ip, fp);
+  else if(strcasecmp(format->driver, "gd2/jpeg") == 0)
+    gdImageJpeg(ip, fp, atoi(msGetOutputFormatOption( format, "QUALITY", "75")));
+  else
+    return MS_FAILURE; /* unsupported format */
+  
   return MS_SUCCESS;
 }
 
-void freeImageGD(imageObj *img) {
+void freeImageGD(imageObj *img) 
+{
+  if(img->img.plugin) gdImageDestroy((gdImagePtr)img->img.plugin);
 }
 
 /*
@@ -108,7 +142,7 @@
   freeImageGD(tile);
 }
 
-void freeSymbol(symbolObj *s) {
+void freeSymbolGD(symbolObj *s) {
 }
 
 inline int populateRendererVTableGD( rendererVTableObj *renderer ) {
@@ -117,15 +151,15 @@
   renderer->supports_transparent_layers = 0;
   renderer->startNewLayer = startNewLayerGD;
   renderer->closeNewLayer = closeNewLayerGD;
-  renderer->renderLine=&renderLineGD;
-  renderer->createImage=&createImageGD;
-  renderer->saveImage=&saveImageGD;
-  renderer->getRasterBuffer=&getRasterBufferGD;
-  renderer->transformShape=&msTransformShape;
-  renderer->renderPolygon=&renderPolygonGD;
-  renderer->renderGlyphsLine=&renderGlyphsLineGD;
-  renderer->renderGlyphs=&renderGlyphsGD;
-  renderer->freeImage=&freeImageGD;
+  renderer->renderLine = &renderLineGD;
+  renderer->createImage = &createImageGD;
+  renderer->saveImage = &saveImageGD;
+  renderer->getRasterBuffer = &getRasterBufferGD;
+  renderer->transformShape = &msTransformShapeToPixel;
+  renderer->renderPolygon = &renderPolygonGD;
+  renderer->renderGlyphsLine = &renderGlyphsLineGD;
+  renderer->renderGlyphs = &renderGlyphsGD;
+  renderer->freeImage = &freeImageGD;
   renderer->renderEllipseSymbol = &renderEllipseSymbolGD;
   renderer->renderVectorSymbol = &renderVectorSymbolGD;
   renderer->renderTruetypeSymbol = &renderTruetypeSymbolGD;



More information about the mapserver-commits mailing list