Skip to content
Permalink
Browse files

Add image/png; mode=16bit as a supported format

  • Loading branch information
rldhont committed May 14, 2013
1 parent 91419ba commit 12fe4fabfde50bfb4aed92b28d21fe4a5087fe53
Showing with 8 additions and 2 deletions.
  1. +7 −1 src/mapserver/qgshttprequesthandler.cpp
  2. +1 −1 src/mapserver/qgswmsserver.cpp
@@ -96,10 +96,11 @@ void QgsHttpRequestHandler::sendGetMapResponse( const QString& service, QImage*
QgsDebugMsg( "Sending getmap response..." );
if ( img )
{
bool png16Bit = ( mFormatString.compare( "image/png; mode=16bit", Qt::CaseInsensitive ) == 0 );
bool png8Bit = ( mFormatString.compare( "image/png; mode=8bit", Qt::CaseInsensitive ) == 0 );
bool png1Bit = ( mFormatString.compare( "image/png; mode=1bit", Qt::CaseInsensitive ) == 0 );
bool isBase64 = mFormatString.endsWith( ";base64", Qt::CaseInsensitive );
if ( mFormat != "PNG" && mFormat != "JPG" && !png8Bit && !png1Bit )
if ( mFormat != "PNG" && mFormat != "JPG" && !png16Bit && !png8Bit && !png1Bit )
{
QgsDebugMsg( "service exception - incorrect image format requested..." );
sendServiceException( QgsMapServiceException( "InvalidFormat", "Output format '" + mFormatString + "' is not supported in the GetMap request" ) );
@@ -119,6 +120,11 @@ void QgsHttpRequestHandler::sendGetMapResponse( const QString& service, QImage*
Qt::ThresholdAlphaDither | Qt::NoOpaqueDetection );
palettedImg.save( &buffer, "PNG", -1 );
}
else if ( png16Bit )
{
QImage palettedImg = img->convertToFormat( QImage::Format_ARGB4444_Premultiplied );
palettedImg.save( &buffer, "PNG", -1 );
}
else if ( png1Bit )
{
QImage palettedImg = img->convertToFormat( QImage::Format_Mono, Qt::MonoOnly | Qt::ThresholdDither |
@@ -171,7 +171,7 @@ QDomDocument QgsWMSServer::getCapabilities( QString version, bool fullProjectInf

//wms:GetMap
elem = doc.createElement( "GetMap"/*wms:GetMap*/ );
appendFormats( doc, elem, QStringList() << "image/jpeg" << "image/png" << "image/png; mode=8bit" << "image/png; mode=1bit" );
appendFormats( doc, elem, QStringList() << "image/jpeg" << "image/png" << "image/png; mode=16bit" << "image/png; mode=8bit" << "image/png; mode=1bit" );
elem.appendChild( dcpTypeElement.cloneNode().toElement() ); //this is the same as for 'GetCapabilities'
requestElement.appendChild( elem );

0 comments on commit 12fe4fa

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