[mapserver-commits] r9873 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Feb 23 00:06:43 EST 2010
Author: warmerdam
Date: 2010-02-23 00:06:40 -0500 (Tue, 23 Feb 2010)
New Revision: 9873
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapdraw.c
trunk/mapserver/mapdrawgdal.c
trunk/mapserver/mapraster.c
trunk/mapserver/mapresample.c
trunk/mapserver/mapresample.h
trunk/mapserver/mapserver.h
trunk/mapserver/mapsvg.c
trunk/mapserver/maputil.c
trunk/mapserver/mapwcs.c
Log:
preliminary work on rendering plugin api rasters
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/HISTORY.TXT 2010-02-23 05:06:40 UTC (rev 9873)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Very preliminary render plugin support for raster rendering. (RFC 54)
+
- support correct MIME type output for WFS 1.1.0 (#3295)
- add WMS 1.3.0 LayerLimit support (#3284)
Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapdraw.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1319,20 +1319,72 @@
}
/**
+ * msDrawRasterLayerPlugin()
+ */
+
+static int
+msDrawRasterLayerPlugin( mapObj *map, layerObj *layer, imageObj *image)
+
+{
+ rendererVTableObj *vtable = image->format->vtable;
+
+ if( vtable->supports_pixel_buffer )
+ {
+ rasterBufferObj rb;
+
+ /* perhaps later there will be more formal initialization? */
+ memset( &rb, 0, sizeof(rb) );
+
+ vtable->getRasterBuffer( image, &rb );
+
+ return msDrawRasterLayerLow( map, layer, image, &rb );
+ }
+ else
+ {
+ return 0; /* not yet implemented */
+
+#ifdef notdef /* implement something like this */
+ rasterBufferObj rb;
+ int ret;
+
+ /* perhaps later there will be more formal initialization? */
+ memset( &rb, 0, sizeof(rb) );
+
+ vtable->initializeRasterBuffer( &rb, image->width, image->height );
+
+ ret = msDrawRasterLayerLow( map, layer, image, &rb );
+
+ if( ret == 0 )
+ {
+ vtable->mergeRasterBuffer( image, &rb, 100.0, 0, 0 );
+ }
+
+ msFreeRasterBuffer( &rb );
+
+ return ret;
+#endif
+ }
+}
+
+/**
* Generic function to render raster layers.
*/
int msDrawRasterLayer(mapObj *map, layerObj *layer, imageObj *image)
{
if (image && map && layer)
{
- if( MS_RENDERER_GD(image->format) )
- return msDrawRasterLayerLow(map, layer, image);
+ if( MS_RENDERER_PLUGIN(image->format) )
+ {
+ return msDrawRasterLayerPlugin(map, layer, image);
+ }
+ else if( MS_RENDERER_GD(image->format) )
+ return msDrawRasterLayerLow(map, layer, image, NULL);
#ifdef USE_AGG
else if( MS_RENDERER_AGG(image->format) )
- return msDrawRasterLayerLow(map, layer, image);
+ return msDrawRasterLayerLow(map, layer, image, NULL);
#endif
else if( MS_RENDERER_RAWDATA(image->format) )
- return msDrawRasterLayerLow(map, layer, image);
+ return msDrawRasterLayerLow(map, layer, image, NULL);
#ifdef USE_MING_FLASH
else if( MS_RENDERER_SWF(image->format) )
return msDrawRasterLayerSWF(map, layer, image);
Modified: trunk/mapserver/mapdrawgdal.c
===================================================================
--- trunk/mapserver/mapdrawgdal.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapdrawgdal.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -99,16 +99,43 @@
#define RGB_LEVEL_INDEX(r,g,b) ((r)*GREEN_LEVELS*BLUE_LEVELS + (g)*BLUE_LEVELS+(b))
#define RGB_INDEX(r,g,b) RGB_LEVEL_INDEX(((r)/RED_DIV),((g)/GREEN_DIV),((b)/BLUE_DIV))
+/*
+ * rasterBufferObj setting macros.
+ */
+
+#define RB_SET_PIXEL(rb,x,y,red,green,blue,alpha) \
+ { \
+ int _rb_off = (x) * (rb)->pixel_step + (y) * (rb)->row_step; \
+ \
+ (rb)->r[_rb_off] = red; \
+ (rb)->g[_rb_off] = green; \
+ (rb)->b[_rb_off] = blue; \
+ if( (rb)->a ) \
+ (rb)->a[_rb_off] = alpha; \
+ }
+
+#define RB_MIX_PIXEL(rb,x,y,red,green,blue,alpha) \
+ { \
+ int _rb_off = (x) * (rb)->pixel_step + (y) * (rb)->row_step; \
+ \
+ msAlphaBlend2( red, green, blue, alpha, \
+ (rb)->r + _rb_off, \
+ (rb)->g + _rb_off, \
+ (rb)->b + _rb_off, \
+ ((rb)->a == NULL ) ? NULL : (rb)->a + _rb_off ); \
+ }
+
/************************************************************************/
/* msDrawRasterLayerGDAL() */
/************************************************************************/
int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image,
- void *hDSVoid )
+ rasterBufferObj *rb, void *hDSVoid )
{
int i,j, k; /* loop counters */
int cmap[MAXCOLORS], cmap_set = FALSE;
+ unsigned char rb_cmap[4][MAXCOLORS], rb_cmap_set = FALSE;
double adfGeoTransform[6], adfInvGeoTransform[6];
int dst_xoff, dst_yoff, dst_xsize, dst_ysize;
int src_xoff, src_yoff, src_xsize, src_ysize;
@@ -124,7 +151,9 @@
GDALDatasetH hDS = hDSVoid;
GDALColorTableH hColorMap;
GDALRasterBandH hBand1=NULL, hBand2=NULL, hBand3=NULL, hBandAlpha=NULL;
+
memset( cmap, 0xff, MAXCOLORS * sizeof(int) );
+ memset( rb_cmap, 0, sizeof(rb_cmap) );
/* -------------------------------------------------------------------- */
/* Test the image format instead of the map format. */
@@ -147,6 +176,11 @@
"COLOR_MATCH_THRESHOLD" )));
}
}
+ else if( MS_RENDERER_PLUGIN(image->format) )
+ {
+ assert( rb != NULL );
+ truecolor = TRUE;
+ }
#ifdef USE_AGG
else if( MS_RENDERER_AGG(image->format) )
{
@@ -313,15 +347,15 @@
* In RAWDATA mode we don't fool with colors. Do the raw processing,
* and return from the function early.
*/
- if( !gdImg )
+ if( MS_RENDERER_RAWDATA( image->format ) )
{
- assert( MS_RENDERER_RAWDATA( image->format ) );
-
return msDrawRasterLayerGDAL_RawMode(
map, layer, image, hDS,
src_xoff, src_yoff, src_xsize, src_ysize,
dst_xoff, dst_yoff, dst_xsize, dst_ysize );
}
+
+ assert( gdImg != NULL || rb != NULL );
/*
* Is this image classified? We consider it classified if there are
@@ -579,10 +613,13 @@
* class colors are provided by the MAP file, or where we use the native
* color table.
*/
- if( classified && gdImg ) {
+ if( classified ) {
int c, color_count;
- cmap_set = TRUE;
+ if( gdImg )
+ cmap_set = TRUE;
+ else if( rb )
+ rb_cmap_set = TRUE;
if( hColorMap == NULL )
{
@@ -609,7 +646,10 @@
c = msGetClass(layer, &pixel);
if(c == -1)/* doesn't belong to any class, so handle like offsite*/
- cmap[i] = -1;
+ {
+ if( gdImg )
+ cmap[i] = -1;
+ }
else
{
int s;
@@ -625,20 +665,46 @@
sEntry.c1 );
}
- RESOLVE_PEN_GD(gdImg, layer->class[c]->styles[0]->color);
- if( MS_TRANSPARENT_COLOR(layer->class[c]->styles[0]->color) )
- cmap[i] = -1;
- else if( MS_VALID_COLOR(layer->class[c]->styles[0]->color))
+ if( gdImg )
{
- /* use class color */
- cmap[i] = layer->class[c]->styles[0]->color.pen;
+ RESOLVE_PEN_GD(gdImg, layer->class[c]->styles[0]->color);
+ if( MS_TRANSPARENT_COLOR(layer->class[c]->styles[0]->color) )
+ cmap[i] = -1;
+ else if( MS_VALID_COLOR(layer->class[c]->styles[0]->color))
+ {
+ /* use class color */
+ cmap[i] = layer->class[c]->styles[0]->color.pen;
+ }
+ else /* Use raster color */
+ cmap[i] = msAddColorGD(map, gdImg, cmt,
+ pixel.red, pixel.green, pixel.blue);
}
- else /* Use raster color */
- cmap[i] = msAddColorGD(map, gdImg, cmt,
- pixel.red, pixel.green, pixel.blue);
+ else if( rb )
+ {
+ if( MS_TRANSPARENT_COLOR(layer->class[c]->styles[0]->color))
+ /* leave it transparent */;
+
+ else if( MS_VALID_COLOR(layer->class[c]->styles[0]->color))
+ {
+ rb_cmap[0][i] = layer->class[c]->styles[0]->color.red;
+ rb_cmap[1][i] = layer->class[c]->styles[0]->color.green;
+ rb_cmap[2][i] = layer->class[c]->styles[0]->color.blue;
+ rb_cmap[3][i] = 255;
+ }
+
+ else /* Use raster color */
+ {
+ rb_cmap[0][i] = pixel.red;
+ rb_cmap[1][i] = pixel.green;
+ rb_cmap[2][i] = pixel.blue;
+ rb_cmap[3][i] = 255;
+ }
+ }
}
- } else
- cmap[i] = -1;
+ } else {
+ if( gdImg )
+ cmap[i] = -1;
+ }
}
} else if( hColorMap != NULL && !truecolor && gdImg ) {
int color_count;
@@ -662,7 +728,7 @@
cmap[i] = -1;
}
}
- else if( hBand2 == NULL && hColorMap != NULL )
+ else if( hBand2 == NULL && hColorMap != NULL && gdImg )
{
int color_count;
cmap_set = TRUE;
@@ -685,6 +751,31 @@
cmap[i] = -1;
}
}
+ else if( hBand2 == NULL && hColorMap != NULL && rb )
+ {
+ int color_count;
+ rb_cmap_set = TRUE;
+
+ color_count = MIN(256,GDALGetColorEntryCount(hColorMap));
+
+ for(i=0; i < color_count; i++) {
+ GDALColorEntry sEntry;
+
+ GDALGetColorEntryAsRGB( hColorMap, i, &sEntry );
+
+ if( sEntry.c4 != 0
+ && (!MS_VALID_COLOR( layer->offsite )
+ || layer->offsite.red != sEntry.c1
+ || layer->offsite.green != sEntry.c2
+ || layer->offsite.blue != sEntry.c3 ) )
+ {
+ rb_cmap[0][i] = sEntry.c1;
+ rb_cmap[1][i] = sEntry.c2;
+ rb_cmap[2][i] = sEntry.c3;
+ rb_cmap[3][i] = sEntry.c4;
+ }
+ }
+ }
else if( !truecolor && gdImg )
{
allocColorCube( map, gdImg, anColorCube );
@@ -790,7 +881,7 @@
}
/* -------------------------------------------------------------------- */
-/* Single band plus colormap and alpha to truecolor. */
+/* Single band plus colormap and alpha to truecolor. (GD) */
/* -------------------------------------------------------------------- */
else if( hBand2 == NULL && truecolor && gdImg && hBandAlpha != NULL )
{
@@ -822,8 +913,51 @@
}
/* -------------------------------------------------------------------- */
-/* Single band plus colormap (no alpha) to truecolor */
+/* Single band plus colormap and alpha to truecolor. (RB) */
/* -------------------------------------------------------------------- */
+ else if( hBand2 == NULL && truecolor && rb && hBandAlpha != NULL )
+ {
+ assert( rb_cmap_set );
+
+ k = 0;
+ for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ )
+ {
+ for( j = dst_xoff; j < dst_xoff + dst_xsize; j++ )
+ {
+ int src_pixel, src_alpha, cmap_alpha, merged_alpha;
+
+ src_alpha = pabyRawAlpha[k];
+ cmap_alpha = rb_cmap[3][k];
+
+ merged_alpha = (src_alpha * cmap_alpha) / 256;
+
+ src_pixel = pabyRaw1[k];
+ if( merged_alpha < 2 )
+ /* do nothing - transparent */;
+ else if( merged_alpha > 253 )
+ {
+ RB_SET_PIXEL( rb, j, i,
+ rb_cmap[0][src_pixel],
+ rb_cmap[1][src_pixel],
+ rb_cmap[2][src_pixel],
+ cmap_alpha );
+ }
+ else
+ {
+ RB_MIX_PIXEL( rb, j, i,
+ rb_cmap[0][src_pixel],
+ rb_cmap[1][src_pixel],
+ rb_cmap[2][src_pixel],
+ merged_alpha );
+ }
+ k++;
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Single band plus colormap (no alpha) to truecolor (GD) */
+/* -------------------------------------------------------------------- */
else if( hBand2 == NULL && truecolor && gdImg )
{
assert( cmap_set );
@@ -843,10 +977,82 @@
}
/* -------------------------------------------------------------------- */
+/* Single band plus colormap (no alpha) to truecolor (RB) */
+/* -------------------------------------------------------------------- */
+ else if( hBand2 == NULL && truecolor && rb )
+ {
+ assert( rb_cmap_set );
+
+ k = 0;
+ for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ )
+ {
+ for( j = dst_xoff; j < dst_xoff + dst_xsize; j++ )
+ {
+ int src_pixel = pabyRaw1[k++];
+
+ if( rb_cmap[3][src_pixel] > 253 )
+ {
+ RB_SET_PIXEL( rb, j, i,
+ rb_cmap[0][src_pixel],
+ rb_cmap[1][src_pixel],
+ rb_cmap[2][src_pixel],
+ rb_cmap[3][src_pixel] );
+ }
+ else if( rb_cmap[3][src_pixel] > 1 )
+ {
+ RB_MIX_PIXEL( rb, j, i,
+ rb_cmap[0][src_pixel],
+ rb_cmap[1][src_pixel],
+ rb_cmap[2][src_pixel],
+ rb_cmap[3][src_pixel] );
+ }
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
/* Input is 3 band RGB. Alpha blending is mixed into the loop */
/* since this case is less commonly used and has lots of other */
-/* overhead. */
+/* overhead. (RB) */
/* -------------------------------------------------------------------- */
+ else if( hBand3 != NULL && rb )
+ {
+ k = 0;
+ for( i = dst_yoff; i < dst_yoff + dst_ysize; i++ )
+ {
+ for( j = dst_xoff; j < dst_xoff + dst_xsize; j++, k++ )
+ {
+ if( MS_VALID_COLOR( layer->offsite )
+ && pabyRaw1[k] == layer->offsite.red
+ && pabyRaw2[k] == layer->offsite.green
+ && pabyRaw3[k] == layer->offsite.blue )
+ continue;
+
+ if( pabyRawAlpha == NULL || pabyRawAlpha[k] == 255 )
+ {
+ RB_SET_PIXEL( rb, j, i,
+ pabyRaw1[k],
+ pabyRaw2[k],
+ pabyRaw3[k],
+ 255 );
+ }
+ else if( pabyRawAlpha[k] != 0 )
+ {
+ RB_MIX_PIXEL( rb, j, i,
+ pabyRaw1[k],
+ pabyRaw2[k],
+ pabyRaw3[k],
+ pabyRawAlpha[k] );
+ }
+ }
+ }
+ }
+
+/* -------------------------------------------------------------------- */
+/* Input is 3 band RGB. Alpha blending is mixed into the loop */
+/* since this case is less commonly used and has lots of other */
+/* overhead. (GD) */
+/* -------------------------------------------------------------------- */
else if( hBand3 != NULL && gdImg )
{
/* Dithered 24bit to 8bit conversion */
Modified: trunk/mapserver/mapraster.c
===================================================================
--- trunk/mapserver/mapraster.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapraster.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1194,7 +1194,8 @@
/* tile indexing. */
/************************************************************************/
-int msDrawRasterLayerLow(mapObj *map, layerObj *layer, imageObj *image)
+int msDrawRasterLayerLow(mapObj *map, layerObj *layer, imageObj *image,
+ rasterBufferObj *rb )
{
int status, i, done;
FILE *f;
@@ -1575,7 +1576,7 @@
&(layer->projection) )
|| CSLFetchNameValue( layer->processing, "RESAMPLE" ) != NULL )
{
- status = msResampleGDALToMap( map, layer, image, hDS );
+ status = msResampleGDALToMap( map, layer, image, rb, hDS );
}
else
#endif
@@ -1590,7 +1591,7 @@
layer->name );
}
- status = msDrawRasterLayerGDAL(map, layer, image, hDS );
+ status = msDrawRasterLayerGDAL(map, layer, image, rb, hDS );
}
if( status == -1 )
Modified: trunk/mapserver/mapresample.c
===================================================================
--- trunk/mapserver/mapresample.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapresample.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1309,7 +1309,7 @@
/************************************************************************/
int msResampleGDALToMap( mapObj *map, layerObj *layer, imageObj *image,
- GDALDatasetH hDS )
+ rasterBufferObj *rb, GDALDatasetH hDS )
{
/* -------------------------------------------------------------------- */
@@ -1579,7 +1579,8 @@
layer->processing = papszAlteredProcessing;
- result = msDrawRasterLayerGDAL( &sDummyMap, layer, srcImage, hDS );
+ result = msDrawRasterLayerGDAL( &sDummyMap, layer, srcImage,
+ NULL, hDS );
layer->processing = papszSavedProcessing;
CSLDestroy( papszAlteredProcessing );
Modified: trunk/mapserver/mapresample.h
===================================================================
--- trunk/mapserver/mapresample.h 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapresample.h 2010-02-23 05:06:40 UTC (rev 9873)
@@ -51,7 +51,7 @@
double *x, double *y, int *panSuccess );
#ifdef USE_GDAL
int msResampleGDALToMap( mapObj *map, layerObj *layer,
- imageObj *image,
+ imageObj *image, rasterBufferObj *rb,
GDALDatasetH hDS );
#endif
#endif /* ndef RESAMPLE_H */
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapserver.h 2010-02-23 05:06:40 UTC (rev 9873)
@@ -2152,7 +2152,7 @@
MS_DLL_EXPORT int msJoinClose(joinObj *join);
/*in mapraster.c */
-MS_DLL_EXPORT int msDrawRasterLayerLow(mapObj *map, layerObj *layer, imageObj *image);
+MS_DLL_EXPORT int msDrawRasterLayerLow(mapObj *map, layerObj *layer, imageObj *image, rasterBufferObj *rb );
MS_DLL_EXPORT int msAddColorGD(mapObj *map, gdImagePtr img, int cmt, int r, int g, int b);
#ifdef USE_AGG
MS_DLL_EXPORT int msAddColorAGG(mapObj *map, gdImagePtr img, int cmt, int r, int g, int b);
@@ -2161,7 +2161,7 @@
MS_DLL_EXPORT int msGetClass_Float(layerObj *layer, float fValue);
/* in mapdrawgdal.c */
-MS_DLL_EXPORT int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image, void *hDSVoid );
+MS_DLL_EXPORT int msDrawRasterLayerGDAL(mapObj *map, layerObj *layer, imageObj *image, rasterBufferObj *rb, void *hDSVoid );
MS_DLL_EXPORT int msGetGDALGeoTransform(void *hDS, mapObj *map, layerObj *layer, double *padfGeoTransform );
MS_DLL_EXPORT int *msGetGDALBandList( layerObj *layer, void *hDS, int max_bands, int *band_count );
MS_DLL_EXPORT double msGetGDALNoDataValue( layerObj *layer, void *hBand, int *pbGotNoData );
@@ -2227,6 +2227,11 @@
MS_DLL_EXPORT imageObj *msImageCreate(int width, int height, outputFormatObj *format, char *imagepath, char *imageurl, mapObj *map);
MS_DLL_EXPORT int msAlphaBlend (int dst, int src);
+MS_DLL_EXPORT void msAlphaBlend2(
+ int red_src, int green_src,
+ int blue_src, int alpha_src,
+ unsigned char *red_dst, unsigned char *green_dst,
+ unsigned char *blue_dst, unsigned char *alpha_dst );
MS_DLL_EXPORT int msCheckParentPointer(void* p, char* objname);
Modified: trunk/mapserver/mapsvg.c
===================================================================
--- trunk/mapserver/mapsvg.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapsvg.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1789,7 +1789,7 @@
/* TODO : msDrawRasterLayerLow returns 0 (ms_success) in some cases */
/* without drawing anything (ex : if it does not fit in scale) */
- if (msDrawRasterLayerLow(map, layer, imagetmp) != MS_FAILURE)
+ if (msDrawRasterLayerLow(map, layer, imagetmp, NULL) != MS_FAILURE)
{
pszTmpfile = msTmpFile(map->mappath,map->web.imagepath,format->extension);
if (!pszTmpfile)
Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/maputil.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1851,6 +1851,65 @@
return ((alpha << 24) + (red << 16) + (green << 8) + blue);
}
+/************************************************************************/
+/* msAlphaBlend2() */
+/* */
+/* Function to overlay/blend an RGBA value into an existing */
+/* RGBA value. Primarily intended for use with rasterBufferObj */
+/* raster rendering. The "src" is the overlay value, and "dst" */
+/* is the existing value being overlaid. */
+/* */
+/* NOTE: alpha_dst may be NULL. */
+/************************************************************************/
+
+void msAlphaBlend2( int red_src, int green_src,
+ int blue_src, int alpha_src,
+ unsigned char *red_dst, unsigned char *green_dst,
+ unsigned char *blue_dst, unsigned char *alpha_dst )
+{
+ int src_weight, dst_weight, tot_weight;
+
+/* -------------------------------------------------------------------- */
+/* Simple cases we want to handle fast. */
+/* -------------------------------------------------------------------- */
+ if( alpha_src < 2 )
+ return;
+
+ if( alpha_src > 253 || (alpha_dst && *alpha_dst < 2) )
+ {
+ *red_dst = red_src;
+ *green_dst = green_src;
+ *blue_dst = blue_src;
+ *alpha_dst = alpha_src;
+ return;
+ }
+
+/* -------------------------------------------------------------------- */
+/* What will the source and destination alphas be? Note that */
+/* the destination weighting is substantially reduced as the */
+/* overlay becomes quite opaque. */
+/* -------------------------------------------------------------------- */
+ src_weight = alpha_src;
+ if( alpha_dst )
+ dst_weight = *alpha_dst * (255-alpha_src) / 255;
+ else
+ dst_weight = 255 - alpha_src;
+ tot_weight = src_weight + dst_weight;
+
+/* -------------------------------------------------------------------- */
+/* What red, green and blue result values will we use? */
+/* -------------------------------------------------------------------- */
+ if( alpha_dst != NULL )
+ *alpha_dst = tot_weight;
+
+ *red_dst = ((src_weight * *red_dst ) + (dst_weight * red_src ))
+ / tot_weight;
+ *green_dst = ((src_weight * *green_dst) + (dst_weight * green_src))
+ / tot_weight;
+ *blue_dst = ((src_weight * *blue_dst ) + (dst_weight * blue_src ))
+ / tot_weight;
+}
+
/*
RFC 24: check if the parent pointer is NULL and raise an error otherwise
*/
Modified: trunk/mapserver/mapwcs.c
===================================================================
--- trunk/mapserver/mapwcs.c 2010-02-23 01:18:49 UTC (rev 9872)
+++ trunk/mapserver/mapwcs.c 2010-02-23 05:06:40 UTC (rev 9873)
@@ -1750,7 +1750,7 @@
return msWCSException(map, NULL, NULL, params->version );
/* Actually produce the "grid". */
- status = msDrawRasterLayerLow( map, lp, image );
+ status = msDrawRasterLayerLow( map, lp, image, NULL );
if( status != MS_SUCCESS ) {
return msWCSException(map, NULL, NULL, params->version );
}
More information about the mapserver-commits
mailing list