Skip to content
Permalink
Browse files

WMS 1.3.0 compliance: support BGCOLOR parameter

  • Loading branch information
mhugent committed Nov 29, 2016
1 parent 63f496c commit ae64430719b2412be65b5611651f828df0eff460
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/server/qgswmsserver.cpp
@@ -1978,6 +1978,19 @@ QImage* QgsWmsServer::createImage( int width, int height ) const
//transparent parameter
bool transparent = mParameters.value( QStringLiteral( "TRANSPARENT" ) ).compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0;

//background color
QString bgColorString = mParameters.value( "BGCOLOR" );
if ( bgColorString.startsWith( "0x", Qt::CaseInsensitive ) );
{
bgColorString.replace( 0, 2, "#" );
}
QColor backgroundColor;
backgroundColor.setNamedColor( bgColorString );
if ( !backgroundColor.isValid() )
{
backgroundColor = QColor( Qt::white );
}

//use alpha channel only if necessary because it slows down performance
if ( transparent && !jpeg )
{
@@ -1987,7 +2000,7 @@ QImage* QgsWmsServer::createImage( int width, int height ) const
else
{
theImage = new QImage( width, height, QImage::Format_RGB32 );
theImage->fill( qRgb( 255, 255, 255 ) );
theImage->fill( backgroundColor );
}

if ( !theImage )

0 comments on commit ae64430

Please sign in to comment.
You can’t perform that action at this time.