[mapserver-commits] r8798 - sandbox/graphics
svn at osgeo.org
svn at osgeo.org
Sat Mar 14 05:42:51 EDT 2009
Author: tbonfort
Date: 2009-03-14 05:42:51 -0400 (Sat, 14 Mar 2009)
New Revision: 8798
Modified:
sandbox/graphics/mapoutput.c
Log:
formatting
Modified: sandbox/graphics/mapoutput.c
===================================================================
--- sandbox/graphics/mapoutput.c 2009-03-14 09:38:14 UTC (rev 8797)
+++ sandbox/graphics/mapoutput.c 2009-03-14 09:42:51 UTC (rev 8798)
@@ -15,7 +15,7 @@
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
- * The above copyright notice and this permission notice shall be included in
+ * The above copyright notice and this permission notice shall be included in
* all copies of this Software or works derived from this Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
@@ -32,7 +32,7 @@
MS_CVSID("$Id$")
-static outputFormatObj *msAllocOutputFormat( mapObj *map, const char *name,
+static outputFormatObj *msAllocOutputFormat( mapObj *map, const char *name,
const char *driver );
/*************************************************************************
@@ -58,32 +58,32 @@
will be derived from the DRIVER or default to the value for
untyped binary data will be used. (optional - may be NULL)
- DRIVER - This indicates which internal driver mechanism is to be used.
+ DRIVER - This indicates which internal driver mechanism is to be used.
Anything prefixed by "GDAL/" will be handled by the GDAL driver, with
the remainder taken as the GDAL format name. (required)
IMAGEMODE - Has one of "PC256", "RGB", or "RGBA" indicating whether
the imaging should be done to a 256 pseudo-colored, 24bit RGB, or
- 32bit RGBA (A=alpha/transparency) result image. Note that the
- IMAGEMODE actually affects how all the rendering for the map is
- done, long before it is output to a particular output format.
- The default value is the traditional "PC256". Some output
+ 32bit RGBA (A=alpha/transparency) result image. Note that the
+ IMAGEMODE actually affects how all the rendering for the map is
+ done, long before it is output to a particular output format.
+ The default value is the traditional "PC256". Some output
formats can only support some IMAGEMODE values. (optional)
- Translate as MS_IMAGEMODE_PC256, MS_IMAGEMODE_RGB and
- MS_IMAGEMODE_RGBA.
+ Translate as MS_IMAGEMODE_PC256, MS_IMAGEMODE_RGB and
+ MS_IMAGEMODE_RGBA.
Not too sure what this should be set to for output formats like
flash and SVG.
- TRANSPARENT - A value of "ON" or "OFF" indicating whether transparency
+ TRANSPARENT - A value of "ON" or "OFF" indicating whether transparency
support should be enabled. Same as the old TRANSPARENT flag
at the MAP level.
- FORMATOPTION - Contains an argument for the specific driver used. There may
- be any number of format options for a given OUTPUTFORMAT
+ FORMATOPTION - Contains an argument for the specific driver used. There may
+ be any number of format options for a given OUTPUTFORMAT
declaration. FORMATOPTION will be used to encode the older
- INTERLACE, and QUALITY values.
+ INTERLACE, and QUALITY values.
Handled as a MapServer style CharArray.
@@ -107,16 +107,16 @@
/* select the current outputformat into map->outputformat */
format = msSelectOutputFormat( map, map->imagetype );
- if( format == NULL )
+ if( format == NULL )
{
- msSetError(MS_MISCERR,
- "Unable to select IMAGETYPE `%s'.",
+ msSetError(MS_MISCERR,
+ "Unable to select IMAGETYPE `%s'.",
"msPostMapParseOutputFormatSetup()",
map->imagetype ? map->imagetype : "(null)" );
return MS_FAILURE;
}
- msApplyOutputFormat( &(map->outputformat), format,
+ msApplyOutputFormat( &(map->outputformat), format,
map->transparent, map->interlace, map->imagequality );
return MS_SUCCESS;
@@ -126,7 +126,7 @@
/* msCreateDefaultOutputFormat() */
/************************************************************************/
-outputFormatObj *msCreateDefaultOutputFormat( mapObj *map,
+outputFormatObj *msCreateDefaultOutputFormat( mapObj *map,
const char *driver )
{
@@ -219,7 +219,7 @@
format->renderer = MS_RENDER_WITH_AGG;
}
#endif
-
+
#if defined(USE_CAIRO)
if( strcasecmp(driver,"CAIRO/PNG") == 0 )
{
@@ -257,19 +257,23 @@
format->renderer = MS_RENDER_WITH_CAIRO;
format->r = msCreateRenderer(MS_RENDER_WITH_CAIRO);
}
+
+
#endif
-#if defined(USE_OGL)
- if( strcasecmp(driver,"OGL/PNG") == 0 )
- {
- format = msAllocOutputFormat( map, "oglpng24", driver );
- format->mimetype = strdup("image/png; mode=24bit");
- format->imagemode = MS_IMAGEMODE_RGB;
- format->extension = strdup("png");
- format->renderer = MS_RENDER_WITH_OGL;
- format->r = msCreateRenderer(MS_RENDER_WITH_OGL);
- }
-#endif
+#if defined(USE_OGL)
+ if( strcasecmp(driver,"OGL/PNG") == 0 )
+ {
+ format = msAllocOutputFormat( map, "oglpng24", driver );
+ format->mimetype = strdup("image/png; mode=24bit");
+ format->imagemode = MS_IMAGEMODE_RGB;
+ format->extension = strdup("png");
+ format->renderer = MS_RENDER_WITH_OGL;
+ format->r = msCreateRenderer(MS_RENDER_WITH_OGL);
+ }
+#endif
+
+
#ifdef USE_MING_FLASH
if( strcasecmp(driver,"swf") == 0 )
@@ -417,7 +421,7 @@
/* msAllocOutputFormat() */
/************************************************************************/
-static outputFormatObj *msAllocOutputFormat( mapObj *map, const char *name,
+static outputFormatObj *msAllocOutputFormat( mapObj *map, const char *name,
const char *driver )
{
@@ -459,7 +463,7 @@
map->outputformatlist[map->numoutputformats-1] = format;
format->refcount++;
}
-
+
return format;
}
@@ -469,7 +473,7 @@
/* Add an output format . */
/* http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=511 */
/************************************************************************/
-int msAppendOutputFormat(mapObj *map, outputFormatObj *format)
+int msAppendOutputFormat(mapObj *map, outputFormatObj *format)
{
/* -------------------------------------------------------------------- */
/* Attach to map. */
@@ -487,7 +491,7 @@
map->outputformatlist[map->numoutputformats-1] = format;
format->refcount++;
}
-
+
return map->numoutputformats;
}
@@ -513,7 +517,7 @@
else
{
i = msGetOutputFormatIndex(map, name);
- if (i >= 0)
+ if (i >= 0)
{
map->numoutputformats--;
if( map->outputformatlist[i]->refcount-- < 1 )
@@ -553,7 +557,7 @@
map->outputformatlist[i]->mimetype) == 0 )
return i;
}
-
+
for( i = 0; i < map->numoutputformats; i++ )
{
if( strcasecmp(imagetype,map->outputformatlist[i]->name) == 0 )
@@ -567,7 +571,7 @@
/* msSelectOutputFormat() */
/************************************************************************/
-outputFormatObj *msSelectOutputFormat( mapObj *map,
+outputFormatObj *msSelectOutputFormat( mapObj *map,
const char *imagetype )
{
@@ -576,7 +580,7 @@
if( map == NULL || imagetype == NULL || strlen(imagetype) == 0 )
return NULL;
-
+
index = msGetOutputFormatIndex(map, imagetype);
if (index >= 0)
format = map->outputformatlist[index];
@@ -592,13 +596,13 @@
map->outputformatlist[i]->mimetype) == 0 )
format = map->outputformatlist[i];
}
-
+
for( i = 0; i < map->numoutputformats && format == NULL; i++ )
{
if( strcasecmp(imagetype,map->outputformatlist[i]->name) == 0 )
format = map->outputformatlist[i];
}
-
+
if (format)
{
if (map->imagetype)
@@ -616,10 +620,10 @@
/* msApplyOutputFormat() */
/************************************************************************/
-void msApplyOutputFormat( outputFormatObj **target,
+void msApplyOutputFormat( outputFormatObj **target,
outputFormatObj *format,
- int transparent,
- int interlaced,
+ int transparent,
+ int interlaced,
int imagequality )
{
@@ -629,7 +633,7 @@
assert( target != NULL );
-
+
if( *target != NULL && --((*target)->refcount) < 1 )
{
formatToFree = *target;
@@ -656,7 +660,7 @@
if( imagequality != MS_NOOVERRIDE && old_imagequality != imagequality )
change_needed = MS_TRUE;
- old_interlaced =
+ old_interlaced =
strcasecmp(msGetOutputFormatOption( format, "INTERLACE", "ON"),
"OFF") != 0;
if( interlaced != MS_NOOVERRIDE && !interlaced != !old_interlaced )
@@ -725,12 +729,12 @@
dst->imagemode = src->imagemode;
dst->renderer = src->renderer;
dst->r = src->r;
-
+
dst->transparent = src->transparent;
dst->bands = src->bands;
dst->numformatoptions = src->numformatoptions;
- dst->formatoptions = (char **)
+ dst->formatoptions = (char **)
malloc(sizeof(char *) * src->numformatoptions );
for( i = 0; i < src->numformatoptions; i++ )
@@ -748,8 +752,8 @@
/* options are in "KEY=VALUE" format. */
/************************************************************************/
-const char *msGetOutputFormatOption( outputFormatObj *format,
- const char *optionkey,
+const char *msGetOutputFormatOption( outputFormatObj *format,
+ const char *optionkey,
const char *defaultresult )
{
@@ -787,7 +791,7 @@
}
sprintf( newline, "%s=%s", key, value );
-
+
/* -------------------------------------------------------------------- */
/* Does this key already occur? If so replace it. */
/* -------------------------------------------------------------------- */
@@ -808,8 +812,8 @@
/* otherwise, we need to grow the list. */
/* -------------------------------------------------------------------- */
format->numformatoptions++;
- format->formatoptions = (char **)
- realloc( format->formatoptions,
+ format->formatoptions = (char **)
+ realloc( format->formatoptions,
sizeof(char*) * format->numformatoptions );
format->formatoptions[format->numformatoptions-1] = newline;
@@ -833,7 +837,7 @@
for( i = 0; i < map->numoutputformats && mime_count < max_mime; i++ )
{
int j;
-
+
if( map->outputformatlist[i]->mimetype == NULL )
continue;
@@ -864,7 +868,7 @@
for( i = 0; i < map->numoutputformats && mime_count < max_mime; i++ )
{
int j;
-
+
if( map->outputformatlist[i]->mimetype == NULL )
continue;
@@ -897,7 +901,7 @@
for( i = 0; i < map->numoutputformats && mime_count < max_mime; i++ )
{
int j;
-
+
if( map->outputformatlist[i]->mimetype == NULL )
continue;
@@ -911,7 +915,7 @@
if( j == mime_count && map->outputformatlist[i]->driver &&
(strncasecmp(map->outputformatlist[i]->driver, "GD/", 3)==0 ||
strncasecmp(map->outputformatlist[i]->driver, "GDAL/", 5)==0 ||
- strcasecmp(map->outputformatlist[i]->driver, "svg")==0))
+ strcasecmp(map->outputformatlist[i]->driver, "svg")==0))
mime_list[mime_count++] = map->outputformatlist[i]->mimetype;
}
@@ -932,24 +936,24 @@
{
int result = MS_TRUE;
- format->bands =
+ format->bands =
atoi(msGetOutputFormatOption( format, "BAND_COUNT", "1" ));
/* Enforce the requirement that GD/JPEG be RGB and TRANSPARENT=OFF */
if( strcasecmp(format->driver,"GD/JPEG") == 0 && format->transparent )
{
msDebug( "GD/JPEG OUTPUTFORMAT %s has TRANSPARENT set ON, but this is not supported.\n"
- "It has been disabled.\n",
+ "It has been disabled.\n",
format->name );
format->transparent = MS_FALSE;
result = MS_FALSE;
}
- if( strcasecmp(format->driver,"GD/JPEG") == 0
+ if( strcasecmp(format->driver,"GD/JPEG") == 0
&& format->imagemode == MS_IMAGEMODE_RGBA )
{
msDebug( "GD/JPEG OUTPUTFORMAT %s has IMAGEMODE RGBA, but this is not supported.\n"
- "IMAGEMODE forced to RGB.\n",
+ "IMAGEMODE forced to RGB.\n",
format->name );
format->imagemode = MS_IMAGEMODE_RGB;
result = MS_FALSE;
@@ -958,15 +962,15 @@
if( format->transparent && format->imagemode == MS_IMAGEMODE_RGB )
{
msDebug( "OUTPUTFORMAT %s has TRANSPARENT set ON, but an IMAGEMODE\n"
- " of RGB instead of RGBA. Changing imagemode to RGBA.\n",
+ " of RGB instead of RGBA. Changing imagemode to RGBA.\n",
format->name );
format->imagemode = MS_IMAGEMODE_RGBA;
result = MS_FALSE;
}
/* see bug 724 */
- if( ( format->imagemode == MS_IMAGEMODE_INT16
- || format->imagemode == MS_IMAGEMODE_FLOAT32
+ if( ( format->imagemode == MS_IMAGEMODE_INT16
+ || format->imagemode == MS_IMAGEMODE_FLOAT32
|| format->imagemode == MS_IMAGEMODE_BYTE )
&& format->renderer != MS_RENDER_WITH_RAWDATA )
format->renderer = MS_RENDER_WITH_RAWDATA;
More information about the mapserver-commits
mailing list