[mapserver-commits] r10189 - sandbox/mapserver6

svn at osgeo.org svn at osgeo.org
Fri May 28 06:55:18 EDT 2010


Author: tbonfort
Date: 2010-05-28 06:55:16 -0400 (Fri, 28 May 2010)
New Revision: 10189

Modified:
   sandbox/mapserver6/mapgd2.c
Log:
update gd2 function signatures


Modified: sandbox/mapserver6/mapgd2.c
===================================================================
--- sandbox/mapserver6/mapgd2.c	2010-05-28 09:47:42 UTC (rev 10188)
+++ sandbox/mapserver6/mapgd2.c	2010-05-28 10:55:16 UTC (rev 10189)
@@ -47,10 +47,12 @@
   return(MS_SUCCESS);
 }
 
-void startNewLayerGD(imageObj *img, mapObj *map, layerObj *layer) {
+int startNewLayerGD(imageObj *img, mapObj *map, layerObj *layer) {
+	return MS_SUCCESS;
 }
 
-void closeNewLayerGD(imageObj *img, mapObj *map, layerObj *layer) { 
+int closeNewLayerGD(imageObj *img, mapObj *map, layerObj *layer) {
+	return MS_SUCCESS;
 }
 
 /*
@@ -113,7 +115,7 @@
   return MS_SUCCESS;
 }
 
-void freeImageGD(imageObj *img) 
+int freeImageGD(imageObj *img) 
 {
   gdImagePtr ip;
 
@@ -121,6 +123,8 @@
     ip = MS_IMAGE_GET_GDIMAGEPTR(img);
     if(ip) gdImageDestroy(ip);
   }
+  
+  return MS_SUCCESS;
 }
 
 /*
@@ -316,13 +320,13 @@
       gdImageLine(im, (int) p->line[i].point[j-1].x, (int) p->line[i].point[j-1].y, (int) p->line[i].point[j].x, (int) p->line[i].point[j].y, c);
 }
 
-void renderLineGD(imageObj *img, shapeObj *p, strokeStyleObj *stroke) 
+int renderLineGD(imageObj *img, shapeObj *p, strokeStyleObj *stroke) 
 {
   gdImagePtr ip;
   int c;
 
-  if(!img || !p || !stroke) return;
-  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return;
+  if(!img || !p || !stroke) return MS_FAILURE;
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
 
   if(stroke->color.pen == MS_PEN_UNSET) setPen(ip, &stroke->color);
   c = stroke->color.pen;
@@ -360,71 +364,106 @@
 
   /* clean up */
   gdImageSetThickness(ip, 1);
+  return MS_SUCCESS;
 }
 
-void renderPolygonGD(imageObj *img, shapeObj *p, colorObj *color) 
+int renderPolygonGD(imageObj *img, shapeObj *p, colorObj *color) 
 {  
   gdImagePtr ip;
 
-  if(!img || !p || !color) return;
-  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return;
+  if(!img || !p || !color) return MS_FAILURE;
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
   if(color->pen == MS_PEN_UNSET) setPen(ip, color);
   imageFilledPolygon(ip, p, color->pen, 0, 0);
+  return MS_SUCCESS;
 }
 
-void renderGlyphsLineGD(imageObj *img, labelPathObj *labelpath, labelStyleObj *style, char *text) {
+int renderGlyphsLineGD(imageObj *img, labelPathObj *labelpath, labelStyleObj *style, char *text) {
+	return MS_SUCCESS;
 }
 
-void renderGlyphsGD(imageObj *img, double x, double y, labelStyleObj *style, char *text) {
+int renderGlyphsGD(imageObj *img, double x, double y, labelStyleObj *style, char *text) {
+	return MS_SUCCESS;
 }
 
-void renderEllipseSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+int renderEllipseSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+	return MS_SUCCESS;
 }
 
-void renderVectorSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+int renderVectorSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+	return MS_SUCCESS;
 }
 
-void renderTruetypeSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *s) {
+int renderTruetypeSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *s) {
+	return MS_SUCCESS;
 }
 
-void renderPixmapSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+int renderPixmapSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
+	return MS_SUCCESS;
 }
 
-void renderTileGD(imageObj *img, imageObj *tile, double x, double y) {
+int renderTileGD(imageObj *img, imageObj *tile, double x, double y) {
+	return MS_SUCCESS;
 }
 
-void renderPolygonTiledGD(imageObj *img, shapeObj *p,  imageObj *tile) 
+int 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;
+  if(!img || !p || !tile) return MS_FAILURE;
+  if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
+  if(!(tp = MS_IMAGE_GET_GDIMAGEPTR(tile))) return MS_FAILURE;
   gdImageSetTile(ip, tp);
-  imageFilledPolygon(ip, p, gdTiled, 0, 0);  
+  imageFilledPolygon(ip, p, gdTiled, 0, 0);
+  return MS_SUCCESS;
 }
 
 /*
 ** GD driver-specific raster buffer functions.
 */
-void getRasterBufferGD(imageObj *img, rasterBufferObj *rb) {
+int getRasterBufferHandleGD(imageObj *img, rasterBufferObj *rb) {
+	//assert(rb->pixelbuffer == NULL);
+	gdImagePtr gdImg = MS_IMAGE_GET_GDIMAGEPTR(img);
+	rb->gd_img = gdImg;
+	rb->width = gdImg->sx;
+	rb->height = gdImg->sy;
+	return MS_SUCCESS;
 }
 
-void mergeRasterBufferGD(imageObj *img, rasterBufferObj *rb, double opacity, int dstX, int dstY) {
+rasterBufferObj* getRasterBufferCopyGD(imageObj *img) {
+	gdImagePtr gdImg = MS_IMAGE_GET_GDIMAGEPTR(img);
+	rasterBufferObj *rb = (rasterBufferObj*)calloc(1,sizeof(rasterBufferObj));
+	rb->width = gdImg->sx;
+	rb->height = gdImg->sy;
+	if(gdImageTrueColor(gdImg)) {
+		rb->gd_img = gdImageCreateTrueColor(gdImg->sx,gdImg->sy);
+	} else {
+		rb->gd_img = gdImageCreate(gdImg->sx,gdImg->sy);
+	}
+	gdImageCopy(gdImg,rb->gd_img,0,0,0,0,gdImg->sx,gdImg->sy);
+	return rb;
 }
 
-int getTruetypeTextBBoxGD(rendererVTableObj *renderer, imageObj *img,char *font, double size, char *text, rectObj *rect, double **advances) {
+int mergeRasterBufferGD(imageObj *dest, rasterBufferObj *overlay, double opacity, int srcX, int srcY, int dstX, int dstY, int width, int height) {
+	if(!dest || !overlay->gd_img) return MS_FAILURE;
+	gdImageCopy(MS_IMAGE_GET_GDIMAGEPTR(dest),overlay->gd_img,dstX,dstY,srcX,srcY,width,height);
+	return MS_SUCCESS;
+}
+
+int getTruetypeTextBBoxGD(rendererVTableObj *renderer, char *font, double size, char *string, rectObj *rect, double **advances) {
   return MS_SUCCESS;
 }
 
 /*
 ** Misc. cleanup functions for GD driver.
 */
-void freeTileGD(imageObj *tile) {
+int freeTileGD(imageObj *tile) {
   freeImageGD(tile);
+  return MS_SUCCESS;
 }
 
-void freeSymbolGD(symbolObj *s) {
+int freeSymbolGD(symbolObj *s) {
+	return MS_SUCCESS;
 }
 
 
@@ -438,7 +477,9 @@
   renderer->renderLine = &renderLineGD;
   renderer->createImage = &createImageGD;
   renderer->saveImage = &saveImageGD;
-  renderer->getRasterBufferHandle = &getRasterBufferGD;
+  renderer->getRasterBufferHandle = &getRasterBufferHandleGD;
+  renderer->getRasterBufferCopy = &getRasterBufferCopyGD;
+    
   renderer->transformShape = &msTransformShapeToPixel;
   renderer->renderPolygon = &renderPolygonGD;
   renderer->renderGlyphsLine = &renderGlyphsLineGD;



More information about the mapserver-commits mailing list