22 #include <QRegularExpression> 
   35     return QStringLiteral( 
"1.3.0" );
 
   46       static const QSet<QString> sFilter
 
   48         QStringLiteral( 
"REQUEST" ),
 
   49         QStringLiteral( 
"VERSION" ),
 
   50         QStringLiteral( 
"SERVICE" ),
 
   51         QStringLiteral( 
"LAYERS" ),
 
   52         QStringLiteral( 
"STYLES" ),
 
   53         QStringLiteral( 
"SLD_VERSION" ),
 
   54         QStringLiteral( 
"_DC" )
 
   60       const QList<QPair<QString, QString> > queryItems = q.queryItems();
 
   61       for ( 
const QPair<QString, QString> ¶m : queryItems )
 
   63         if ( sFilter.contains( param.first.toUpper() ) )
 
   64           q.removeAllQueryItems( param.first );
 
   76     if ( format.compare( QLatin1String( 
"png" ), Qt::CaseInsensitive ) == 0 ||
 
   77          format.compare( QLatin1String( 
"image/png" ), Qt::CaseInsensitive ) == 0 )
 
   81     else if ( format.compare( QLatin1String( 
"jpg " ), Qt::CaseInsensitive ) == 0  ||
 
   82               format.compare( QLatin1String( 
"image/jpeg" ), Qt::CaseInsensitive ) == 0 )
 
   86     else if ( format.compare( QLatin1String( 
"webp" ), Qt::CaseInsensitive ) == 0  ||
 
   87               format.compare( QLatin1String( 
"image/webp" ), Qt::CaseInsensitive ) == 0 )
 
   94       const QRegularExpression modeExpr = QRegularExpression( QStringLiteral( 
"image/png\\s*;\\s*mode=([^;]+)" ),
 
   95                                           QRegularExpression::CaseInsensitiveOption );
 
   97       const QRegularExpressionMatch match = modeExpr.match( format );
 
   98       const QString mode = match.captured( 1 );
 
   99       if ( mode.compare( QLatin1String( 
"16bit" ), Qt::CaseInsensitive ) == 0 )
 
  101       if ( mode.compare( QLatin1String( 
"8bit" ), Qt::CaseInsensitive ) == 0 )
 
  103       if ( mode.compare( QLatin1String( 
"1bit" ), Qt::CaseInsensitive ) == 0 )
 
  118     switch ( outputFormat )
 
  122         contentType = 
"image/png";
 
  127         QVector<QRgb> colorTable;
 
  132         const QImage img256 = img.convertToFormat( QImage::Format_ARGB32 );
 
  134         result = img256.convertToFormat( QImage::Format_Indexed8, colorTable,
 
  135                                          Qt::ColorOnly | Qt::ThresholdDither |
 
  136                                          Qt::ThresholdAlphaDither | Qt::NoOpaqueDetection );
 
  138       contentType = 
"image/png";
 
  142         result = img.convertToFormat( QImage::Format_ARGB4444_Premultiplied );
 
  143         contentType = 
"image/png";
 
  147         result = img.convertToFormat( QImage::Format_Mono,
 
  148                                       Qt::MonoOnly | Qt::ThresholdDither |
 
  149                                       Qt::ThresholdAlphaDither | Qt::NoOpaqueDetection );
 
  150         contentType = 
"image/png";
 
  155         contentType = 
"image/jpeg";
 
  160         contentType = QStringLiteral( 
"image/webp" );
 
  161         saveFormat = QStringLiteral( 
"WEBP" );
 
  170     result.setDotsPerMeterX( img.dotsPerMeterX() );
 
  171     result.setDotsPerMeterY( img.dotsPerMeterY() );
 
  173     if ( outputFormat != 
UNKN )
 
  175       response.
setHeader( 
"Content-Type", contentType );
 
  176       if ( saveFormat == QLatin1String( 
"JPEG" ) || saveFormat == QLatin1String( 
"WEBP" ) )
 
  178         result.save( response.
io(), qPrintable( saveFormat ), imageQuality );
 
  182         result.save( response.
io(), qPrintable( saveFormat ) );
 
  188       parameter.mValue = formatStr;