summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimagewriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qimagewriter.cpp')
-rw-r--r--src/gui/image/qimagewriter.cpp79
1 files changed, 72 insertions, 7 deletions
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index fa261df1a5..b418101163 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -252,6 +252,8 @@ public:
QString description;
QString text;
QByteArray subType;
+ bool optimizedWrite;
+ bool progressiveScanWrite;
// error
QImageWriter::ImageWriterError imageWriterError;
@@ -271,6 +273,8 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
quality = -1;
compression = 0;
gamma = 0.0;
+ optimizedWrite = false;
+ progressiveScanWrite = false;
imageWriterError = QImageWriter::UnknownError;
errorString = QImageWriter::tr("Unknown error");
@@ -555,6 +559,63 @@ QList<QByteArray> QImageWriter::supportedSubTypes() const
}
/*!
+ \since 5.5
+
+ This is an image format-specific function which sets the \a optimize flags when
+ writing images. For image formats that do not support setting an \a optimize flag,
+ this value is ignored.
+
+ The default is false.
+
+ \sa optimizedWrite()
+*/
+void QImageWriter::setOptimizedWrite(bool optimize)
+{
+ d->optimizedWrite = optimize;
+}
+
+/*!
+ \since 5.5
+
+ Returns whether optimization has been turned on for writing the image.
+
+ \sa setOptimizedWrite()
+*/
+bool QImageWriter::optimizedWrite() const
+{
+ return d->optimizedWrite;
+}
+
+/*!
+ \since 5.5
+
+ This is an image format-specific function which turns on \a progressive scanning
+ when writing images. For image formats that do not support setting a \a progressive
+ scan flag, this value is ignored.
+
+ The default is false.
+
+ \sa progressiveScanWrite()
+*/
+
+void QImageWriter::setProgressiveScanWrite(bool progressive)
+{
+ d->progressiveScanWrite = progressive;
+}
+
+/*!
+ \since 5.5
+
+ Returns whether the image should be written as a progressive image.
+
+ \sa setProgressiveScanWrite()
+*/
+bool QImageWriter::progressiveScanWrite() const
+{
+ return d->progressiveScanWrite;
+}
+
+/*!
\obsolete
Use setText() instead.
@@ -657,6 +718,10 @@ bool QImageWriter::write(const QImage &image)
d->handler->setOption(QImageIOHandler::Description, d->description);
if (!d->subType.isEmpty() && d->handler->supportsOption(QImageIOHandler::SubType))
d->handler->setOption(QImageIOHandler::SubType, d->subType);
+ if (d->handler->supportsOption(QImageIOHandler::OptimizedWrite))
+ d->handler->setOption(QImageIOHandler::OptimizedWrite, d->optimizedWrite);
+ if (d->handler->supportsOption(QImageIOHandler::ProgressiveScanWrite))
+ d->handler->setOption(QImageIOHandler::ProgressiveScanWrite, d->progressiveScanWrite);
if (!d->handler->write(image))
return false;