244 if (!autoDetectImageFormat && format.
isEmpty())
250 #ifndef QT_NO_LIBRARY 257 #ifdef QIMAGEREADER_DEBUG 258 qDebug() <<
"QImageReader::createReadHandler( device =" << (
void *)device <<
", format =" << format <<
")," 259 << keys.
size() <<
"plugins available: " <<
keys;
262 #ifndef QT_NO_LIBRARY 264 if (device && format.
isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) {
268 if (
QFile *file = qobject_cast<QFile *>(device)) {
269 #ifdef QIMAGEREADER_DEBUG 270 qDebug() <<
"QImageReader::createReadHandler: device is a file:" << file->fileName();
275 #ifdef QIMAGEREADER_DEBUG 276 qDebug() <<
"QImageReader::createReadHandler: suffix recognized; the" 277 << suffix <<
"plugin might be able to read this";
279 suffixPluginIndex =
index;
284 #endif // QT_NO_LIBRARY 288 if (ignoresFormatAndExtension)
291 #ifndef QT_NO_LIBRARY 292 if (suffixPluginIndex != -1) {
295 const qint64 pos = device ? device->
pos() : 0;
298 handler = plugin->
create(device, testFormat);
299 #ifdef QIMAGEREADER_DEBUG 300 qDebug() <<
"QImageReader::createReadHandler: using the" << suffix
308 if (!handler && !testFormat.
isEmpty() && !ignoresFormatAndExtension) {
311 const qint64 pos = device ? device->
pos() : 0;
313 if (autoDetectImageFormat) {
314 for (
int i = 0; i < keys.
size(); ++i) {
315 if (i != suffixPluginIndex) {
318 #ifdef QIMAGEREADER_DEBUG 319 qDebug() <<
"QImageReader::createReadHandler: the" << keys.
at(i) <<
"plugin can read this format";
321 handler = plugin->
create(device, testFormat);
329 #ifdef QIMAGEREADER_DEBUG 330 qDebug() <<
"QImageReader::createReadHandler: the" << testFormat <<
"plugin can read this format";
332 handler = plugin->
create(device, testFormat);
339 #endif // QT_NO_LIBRARY 343 if (!handler && !testFormat.
isEmpty()) {
345 #ifndef QT_NO_IMAGEFORMAT_PNG 346 }
else if (testFormat ==
"png") {
349 #ifndef QT_NO_IMAGEFORMAT_JPEG 350 }
else if (testFormat ==
"jpg" || testFormat ==
"jpeg") {
353 #ifndef QT_NO_IMAGEFORMAT_MNG 354 }
else if (testFormat ==
"mng") {
357 #ifndef QT_NO_IMAGEFORMAT_TIFF 358 }
else if (testFormat ==
"tif" || testFormat ==
"tiff") {
361 #ifdef QT_BUILTIN_GIF_READER 362 }
else if (testFormat ==
"gif") {
365 #ifndef QT_NO_IMAGEFORMAT_BMP 366 }
else if (testFormat ==
"bmp") {
369 #ifndef QT_NO_IMAGEFORMAT_XPM 370 }
else if (testFormat ==
"xpm") {
373 #ifndef QT_NO_IMAGEFORMAT_XBM 374 }
else if (testFormat ==
"xbm") {
378 #ifndef QT_NO_IMAGEFORMAT_PPM 379 }
else if (testFormat ==
"pbm" || testFormat ==
"pbmraw" || testFormat ==
"pgm" 380 || testFormat ==
"pgmraw" || testFormat ==
"ppm" || testFormat ==
"ppmraw") {
386 #ifdef QIMAGEREADER_DEBUG 388 qDebug() <<
"QImageReader::createReadHandler: using the built-in handler for" <<
testFormat;
392 #ifndef QT_NO_LIBRARY 393 if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
395 const qint64 pos = device ? device->
pos() : 0;
396 for (
int i = 0; i < keys.
size(); ++i) {
397 if (i != suffixPluginIndex) {
400 handler = plugin->
create(device, testFormat);
401 #ifdef QIMAGEREADER_DEBUG 402 qDebug() <<
"QImageReader::createReadHandler: the" << keys.
at(i) <<
"plugin can read this data";
411 #endif // QT_NO_LIBRARY 413 if (!handler && (autoDetectImageFormat || ignoresFormatAndExtension)) {
416 int currentFormat = 0;
420 for (
int i = 0; i < _qt_NumFormats; ++i) {
429 int numFormats = _qt_NumFormats;
430 while (device && numFormats >= 0) {
434 switch (formatStruct->
type) {
435 #ifndef QT_NO_IMAGEFORMAT_PNG 441 #ifndef QT_NO_IMAGEFORMAT_JPEG 447 #ifndef QT_NO_IMAGEFORMAT_MNG 453 #ifndef QT_NO_IMAGEFORMAT_TIFF 459 #ifdef QT_BUILTIN_GIF_READER 465 #ifndef QT_NO_IMAGEFORMAT_BMP 471 #ifndef QT_NO_IMAGEFORMAT_XPM 477 #ifndef QT_NO_IMAGEFORMAT_PPM 487 #ifndef QT_NO_IMAGEFORMAT_XBM 500 #ifdef QIMAGEREADER_DEBUG 501 qDebug() <<
"QImageReader::createReadHandler: the" << formatStruct->
extension 502 <<
"built-in handler can read this data";
509 currentFormat %= _qt_NumFormats;
514 #ifdef QIMAGEREADER_DEBUG 515 qDebug() <<
"QImageReader::createReadHandler: no handlers found. giving up.";
bool canRead() const
Returns true if an image can be read from the device (i.
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...
The QByteArray class provides an array of bytes.
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
bool canRead() const
Returns true if an image can be read from the device (i.
QByteArray toLower() const
Returns a lowercase copy of the byte array.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
T * qobject_cast(QObject *object)
Q_CORE_EXPORT void qDebug(const char *,...)
virtual void setOption(ImageOption option, const QVariant &value)
Sets the option option with the value value.
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...
static bool isEmpty(const char *str)
bool canRead() const
Returns true if an image can be read from the device (i.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
bool canRead() const
Returns true if an image can be read from the device (i.
virtual bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
virtual QImageIOHandler * create(QIODevice *device, const QByteArray &format=QByteArray()) const =0
Creates and returns a QImageIOHandler subclass, with device and format set.
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.
bool canRead() const
Returns true if an image can be read from the device (i.
The QImageIOPlugin class defines an interface for writing an image format plugin. ...
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
int size() const
Returns the number of items in the list.
bool canRead() const
Returns true if an image can be read from the device (i.
static const _qt_BuiltInFormatStruct _qt_BuiltInFormats[]
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QFileInfo class provides system-independent file information.
QImageIOHandler * handler
bool canRead() const
Returns true if an image can be read from the device (i.
virtual bool canRead() const
Reimplemented Function
bool canRead() const
Returns true if an image can be read from the device (i.
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...