113 #include <private/qfactoryloader_p.h> 116 #include <private/qbmphandler_p.h> 117 #include <private/qppmhandler_p.h> 118 #include <private/qxbmhandler_p.h> 119 #include <private/qxpmhandler_p.h> 120 #ifndef QT_NO_IMAGEFORMAT_PNG 121 #include <private/qpnghandler_p.h> 123 #ifndef QT_NO_IMAGEFORMAT_JPEG 124 #include <private/qjpeghandler_p.h> 126 #ifndef QT_NO_IMAGEFORMAT_MNG 127 #include <private/qmnghandler_p.h> 129 #ifndef QT_NO_IMAGEFORMAT_TIFF 130 #include <private/qtiffhandler_p.h> 132 #ifdef QT_BUILTIN_GIF_READER 133 #include <private/qgifhandler_p.h> 138 #ifndef QT_NO_LIBRARY 150 #ifndef QT_NO_LIBRARY 161 if (
QFile *file = qobject_cast<QFile *>(device)) {
163 #ifndef QT_NO_LIBRARY 166 suffixPluginIndex =
index;
174 #ifndef QT_NO_LIBRARY 175 if (suffixPluginIndex != -1) {
180 handler = plugin->
create(device, suffix);
182 #endif // QT_NO_LIBRARY 187 #ifndef QT_NO_IMAGEFORMAT_PNG 188 }
else if (testFormat ==
"png") {
191 #ifndef QT_NO_IMAGEFORMAT_JPEG 192 }
else if (testFormat ==
"jpg" || testFormat ==
"jpeg") {
195 #ifndef QT_NO_IMAGEFORMAT_MNG 196 }
else if (testFormat ==
"mng") {
199 #ifndef QT_NO_IMAGEFORMAT_TIFF 200 }
else if (testFormat ==
"tif" || testFormat ==
"tiff") {
203 #ifdef QT_BUILTIN_GIF_READER 204 }
else if (testFormat ==
"gif") {
207 #ifndef QT_NO_IMAGEFORMAT_BMP 208 }
else if (testFormat ==
"bmp") {
211 #ifndef QT_NO_IMAGEFORMAT_XPM 212 }
else if (testFormat ==
"xpm") {
215 #ifndef QT_NO_IMAGEFORMAT_XBM 216 }
else if (testFormat ==
"xbm") {
220 #ifndef QT_NO_IMAGEFORMAT_PPM 221 }
else if (testFormat ==
"pbm" || testFormat ==
"pbmraw" || testFormat ==
"pgm" 222 || testFormat ==
"pgmraw" || testFormat ==
"ppm" || testFormat ==
"ppmraw") {
229 #ifndef QT_NO_LIBRARY 231 for (
int i = 0; i < keys.
size(); ++i) {
235 handler = plugin->
create(device, testFormat);
240 #endif // QT_NO_LIBRARY 708 #ifndef QT_NO_IMAGEFORMAT_PPM 711 #ifndef QT_NO_IMAGEFORMAT_XBM 714 #ifndef QT_NO_IMAGEFORMAT_XPM 717 #ifndef QT_NO_IMAGEFORMAT_PNG 720 #ifndef QT_NO_IMAGEFORMAT_JPEG 721 formats <<
"jpg" <<
"jpeg";
723 #ifndef QT_NO_IMAGEFORMAT_MNG 726 #ifndef QT_NO_IMAGEFORMAT_TIFF 727 formats <<
"tif" <<
"tiff";
729 #ifdef QT_BUILTIN_GIF_READER 733 #ifndef QT_NO_LIBRARY 736 for (
int i = 0; i < keys.
count(); ++i) {
741 #endif // QT_NO_LIBRARY 745 sortedFormats << *
it;
747 qSort(sortedFormats);
748 return sortedFormats;
T qobject_cast(QObject *object)
QImageWriterPrivate(QImageWriter *qq)
QString fileName() const
Returns the name set by setFileName() or to the QFile constructors.
void setFormat(const QByteArray &format)
Sets the format of the QImageIOHandler to format.
virtual Capabilities capabilities(QIODevice *device, const QByteArray &format) const =0
Returns the capabilities on the plugin, based on the data in device and the format format...
#define QImageIOHandlerFactoryInterface_iid
ImageWriterError
This enum describes errors that can occur when writing images with QImageWriter.
#define QT_END_NAMESPACE
This macro expands to.
QString fileName() const
If the currently assigned device is a QFile, or if setFileName() has been called, this function retur...
bool isWritable() const
Returns true if data can be written to the device; otherwise returns false.
#define it(className, varName)
bool supportsOption(QImageIOHandler::ImageOption option) const
Returns true if the writer supports option; otherwise returns false.
void setFileName(const QString &fileName)
Sets the file name of QImageWriter to fileName.
const_iterator constEnd() const
The QByteArray class provides an array of bytes.
QByteArray format() const
Returns the format QImageWriter uses for writing images.
void setQuality(int quality)
This is an image format specific function that sets the quality level of the image to quality...
QByteArray toLower() const
Returns a lowercase copy of the byte array.
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
QImageIOHandler * handler
virtual bool write(const QImage &image)
Writes the image image to the assigned device.
virtual void setOption(ImageOption option, const QVariant &value)
Sets the option option with the value value.
QIODevice * device() const
Returns the device currently assigned to QImageWriter, or 0 if no device has been assigned...
int indexOf(const QRegExp &rx, int from=0) const
Returns the index position of the first exact match of rx in the list, searching forward from index p...
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isOpen() const
Returns true if the device is open; otherwise returns false.
static bool isEmpty(const char *str)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QImageWriter class provides a format independent interface for writing images to files or other d...
ImageOption
This enum describes the different options supported by QImageIOHandler.
QImageWriter::ImageWriterError imageWriterError
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
The QImage class provides a hardware-independent image representation that allows direct access to th...
float gamma() const
Returns the gamma level of the image.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
virtual QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const =0
Creates and returns a QImageIOHandler subclass, with device and format set.
~QImageWriter()
Destructs the QImageWriter object.
void setDevice(QIODevice *device)
Sets QImageWriter's device to device.
bool canWrite() const
Returns true if QImageWriter can write the image; i.e., the image format is supported and the assigne...
void setGamma(float gamma)
This is an image format specific function that sets the gamma level of the image to gamma...
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,(QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) static QImageIOHandler *createWriteHandlerHelper(QIODevice *device
void setDevice(QIODevice *device)
Sets the device of the QImageIOHandler to device.
The QFile class provides an interface for reading from and writing to files.
The QImageIOPlugin class defines an interface for writing an image format plugin. ...
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt...
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QObject * instance(const QString &key) const
QString description() const
Use QImageReader::text() instead.
int size() const
Returns the number of items in the list.
int quality() const
Returns the quality level of the image.
const_iterator constBegin() const
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
ImageWriterError error() const
Returns the type of error that last occurred.
void setFormat(const QByteArray &format)
Sets the format QImageWriter will use when writing images, to format.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
void setText(const QString &key, const QString &text)
Sets the image text associated with the key key to text.
void setDescription(const QString &description)
Use setText() instead.
static QList< QByteArray > supportedImageFormats()
Returns the list of image formats supported by QImageWriter.
The QFileInfo class provides system-independent file information.
QImageIOHandler * handler
virtual bool supportsOption(ImageOption option) const
Returns true if the QImageIOHandler supports the option option; otherwise returns false...
The QIODevice class is the base interface class of all I/O devices in Qt.
QImageWriter()
Constructs an empty QImageWriter object.
int compression() const
Returns the compression of the image.
bool write(const QImage &image)
Writes the image image to the assigned device or file name.
QString errorString() const
Returns a human readable description of the last error that occurred.
void setCompression(int compression)
This is an image format specific function that set the compression of an image.