[mapserver-commits] r10236 - sandbox/mapserver6
svn at osgeo.org
svn at osgeo.org
Fri Jun 18 05:27:36 EDT 2010
Author: tbonfort
Date: 2010-06-18 09:27:36 +0000 (Fri, 18 Jun 2010)
New Revision: 10236
Modified:
sandbox/mapserver6/mapgd2.c
Log:
image symbol rotation
Modified: sandbox/mapserver6/mapgd2.c
===================================================================
--- sandbox/mapserver6/mapgd2.c 2010-06-18 08:31:59 UTC (rev 10235)
+++ sandbox/mapserver6/mapgd2.c 2010-06-18 09:27:36 UTC (rev 10236)
@@ -691,21 +691,36 @@
}
int renderPixmapSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
- gdImagePtr ip;
+ gdImagePtr ip,pp;
if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
assert(symbol->pixmap_buffer && symbol->pixmap_buffer->type == MS_BUFFER_GD);
- if(style->scale == 1.0) { /* don't scale */
+ pp = symbol->pixmap_buffer->data.gd_img;
+ gdImageAlphaBlending(ip,1);
+ gdImageAlphaBlending(pp,1);
+
+ if(symbol->transparent)
+ gdImageColorTransparent(pp,symbol->transparentcolor);
+ if(style->scale == 1.0 && style->rotation == 0.0) { /* don't scale */
x -= .5*symbol->pixmap_buffer->width;
y -= .5*symbol->pixmap_buffer->height;
- gdImageCopy(ip, symbol->pixmap_buffer->data.gd_img, x, y, 0, 0, symbol->pixmap_buffer->width,symbol->pixmap_buffer->height);
+ gdImageCopy(ip, pp, x, y, 0, 0, symbol->pixmap_buffer->width,symbol->pixmap_buffer->height);
} else {
- x -= .5*symbol->pixmap_buffer->width*style->scale;
- y -= .5*symbol->pixmap_buffer->height*style->scale;
- gdImageCopyResampled(ip, symbol->pixmap_buffer->data.gd_img, x, y, 0, 0,
- (int)(symbol->pixmap_buffer->width * style->scale),
- (int)(symbol->pixmap_buffer->height * style->scale),
- symbol->pixmap_buffer->width,symbol->pixmap_buffer->height);
+ int bRotated = MS_FALSE;
+ if(style->rotation) {
+ bRotated = MS_TRUE;
+ pp = rotatePixmapGD(pp,style->rotation);
+ }
+ x -= .5*gdImageSX(pp)*style->scale;
+ y -= .5*gdImageSY(pp)*style->scale;
+ gdImageCopyResampled(ip, pp, x, y, 0, 0,
+ (int)(gdImageSX(pp) * style->scale),
+ (int)(gdImageSY(pp) * style->scale),
+ gdImageSX(pp),gdImageSY(pp));
+ if(bRotated) {
+ gdImageDestroy(pp);
+ }
}
+ gdImageAlphaBlending(ip,0);
return MS_SUCCESS;
}
@@ -720,6 +735,7 @@
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;
+ gdImageColorTransparent(tp,0);
gdImageSetTile(ip, tp);
imageFilledPolygon(ip, p, gdTiled, 0, 0);
return MS_SUCCESS;
More information about the mapserver-commits
mailing list