Qt 4.8
Public Functions | Static Public Functions | Properties | List of all members
QMngHandler Class Reference

#include <qmnghandler_p.h>

Inheritance diagram for QMngHandler:
QImageIOHandler

Public Functions

virtual bool canRead () const
 Reimplemented Function More...
 
virtual int currentImageNumber () const
 Reimplemented Function More...
 
virtual int imageCount () const
 Reimplemented Function More...
 
virtual bool jumpToImage (int imageNumber)
 Reimplemented Function More...
 
virtual bool jumpToNextImage ()
 Reimplemented Function More...
 
virtual int loopCount () const
 Reimplemented Function More...
 
virtual QByteArray name () const
 Reimplemented Function More...
 
virtual int nextImageDelay () const
 Reimplemented Function More...
 
virtual QVariant option (ImageOption option) const
 Reimplemented Function More...
 
 QMngHandler ()
 
virtual bool read (QImage *image)
 Reimplemented Function More...
 
virtual void setOption (ImageOption option, const QVariant &value)
 Reimplemented Function More...
 
virtual bool supportsOption (ImageOption option) const
 Reimplemented Function More...
 
virtual bool write (const QImage &image)
 Reimplemented Function More...
 
 ~QMngHandler ()
 
- Public Functions inherited from QImageIOHandler
virtual QRect currentImageRect () const
 Returns the rect of the current image. More...
 
QIODevicedevice () const
 Returns the device currently assigned to the QImageIOHandler. More...
 
QByteArray format () const
 Returns the format that is currently assigned to QImageIOHandler. More...
 
 QImageIOHandler ()
 Constructs a QImageIOHandler object. More...
 
void setDevice (QIODevice *device)
 Sets the device of the QImageIOHandler to device. More...
 
void setFormat (const QByteArray &format)
 Sets the format of the QImageIOHandler to format. More...
 
void setFormat (const QByteArray &format) const
 Sets the format of the QImageIOHandler to format. More...
 
virtual ~QImageIOHandler ()
 Destructs the QImageIOHandler object. More...
 

Static Public Functions

static bool canRead (QIODevice *device)
 

Properties

QScopedPointer< QMngHandlerPrivated_ptr
 

Additional Inherited Members

- Public Types inherited from QImageIOHandler
enum  ImageOption {
  Size, ClipRect, Description, ScaledClipRect,
  ScaledSize, CompressionRatio, Gamma, Quality,
  Name, SubType, IncrementalReading, Endianness,
  Animation, BackgroundColor, ImageFormat
}
 This enum describes the different options supported by QImageIOHandler. More...
 
- Protected Functions inherited from QImageIOHandler
 QImageIOHandler (QImageIOHandlerPrivate &dd)
 Constructs a QImageIOHandler object, using the private member dd. More...
 
- Protected Variables inherited from QImageIOHandler
QScopedPointer< QImageIOHandlerPrivated_ptr
 

Detailed Description

Definition at line 56 of file qmnghandler_p.h.

Constructors and Destructors

◆ QMngHandler()

QMngHandler::QMngHandler ( )

Definition at line 378 of file qmnghandler.cpp.

379  : d_ptr(new QMngHandlerPrivate(this))
380 {
381 }
QScopedPointer< QMngHandlerPrivate > d_ptr
Definition: qmnghandler_p.h:78

◆ ~QMngHandler()

QMngHandler::~QMngHandler ( )

Definition at line 383 of file qmnghandler.cpp.

384 {
385 }

Functions

◆ canRead() [1/2]

bool QMngHandler::canRead ( ) const
virtual

Reimplemented Function

Implements QImageIOHandler.

Definition at line 388 of file qmnghandler.cpp.

Referenced by QMngPlugin::capabilities(), createReadHandlerHelper(), and read().

389 {
390  Q_D(const QMngHandler);
391  if ((!d->haveReadNone
392  && (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount))))
393  || canRead(device()))
394  {
395  setFormat("mng");
396  return true;
397  }
398  return false;
399 }
double d
Definition: qnumeric_p.h:62
void setFormat(const QByteArray &format)
Sets the format of the QImageIOHandler to format.
#define Q_D(Class)
Definition: qglobal.h:2482
QIODevice * device() const
Returns the device currently assigned to the QImageIOHandler.
virtual bool canRead() const
Reimplemented Function

◆ canRead() [2/2]

bool QMngHandler::canRead ( QIODevice device)
static
Warning
This function is not part of the public interface.

Definition at line 402 of file qmnghandler.cpp.

403 {
404  if (!device) {
405  qWarning("QMngHandler::canRead() called with no device");
406  return false;
407  }
408 
409  return device->peek(8) == "\x8A\x4D\x4E\x47\x0D\x0A\x1A\x0A";
410 }
qint64 peek(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, without side effects (i.
Definition: qiodevice.cpp:1563
Q_CORE_EXPORT void qWarning(const char *,...)

◆ currentImageNumber()

int QMngHandler::currentImageNumber ( ) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 433 of file qmnghandler.cpp.

434 {
435  Q_D(const QMngHandler);
436  return d->currentImageNumber();
437 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ imageCount()

int QMngHandler::imageCount ( ) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 440 of file qmnghandler.cpp.

441 {
442  Q_D(const QMngHandler);
443  return d->imageCount();
444 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ jumpToImage()

bool QMngHandler::jumpToImage ( int  imageNumber)
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 447 of file qmnghandler.cpp.

448 {
449  Q_D(QMngHandler);
450  return d->jumpToImage(imageNumber);
451 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ jumpToNextImage()

bool QMngHandler::jumpToNextImage ( )
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 454 of file qmnghandler.cpp.

455 {
456  Q_D(QMngHandler);
457  return d->jumpToNextImage();
458 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ loopCount()

int QMngHandler::loopCount ( ) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 461 of file qmnghandler.cpp.

462 {
463  Q_D(const QMngHandler);
464  if (d->iterCount == 0x7FFFFFFF)
465  return -1; // infinite loop
466  return d->iterCount-1;
467 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ name()

QByteArray QMngHandler::name ( ) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 413 of file qmnghandler.cpp.

414 {
415  return "mng";
416 }

◆ nextImageDelay()

int QMngHandler::nextImageDelay ( ) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 470 of file qmnghandler.cpp.

471 {
472  Q_D(const QMngHandler);
473  return d->nextImageDelay();
474 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

◆ option()

QVariant QMngHandler::option ( ImageOption  option) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 477 of file qmnghandler.cpp.

478 {
479  Q_D(const QMngHandler);
481  return true;
483  return d->backgroundColor();
484  return QVariant();
485 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
virtual QVariant option(ImageOption option) const
Reimplemented Function

◆ read()

bool QMngHandler::read ( QImage image)
virtual

Reimplemented Function

Implements QImageIOHandler.

Definition at line 419 of file qmnghandler.cpp.

420 {
421  Q_D(QMngHandler);
422  return canRead() ? d->getNextImage(image) : false;
423 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
virtual bool canRead() const
Reimplemented Function

◆ setOption()

void QMngHandler::setOption ( ImageOption  option,
const QVariant value 
)
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 488 of file qmnghandler.cpp.

489 {
490  Q_D(QMngHandler);
492  d->setBackgroundColor(qvariant_cast<QColor>(value));
493 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
virtual QVariant option(ImageOption option) const
Reimplemented Function

◆ supportsOption()

bool QMngHandler::supportsOption ( ImageOption  option) const
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 496 of file qmnghandler.cpp.

497 {
499  return true;
501  return true;
502  return false;
503 }
virtual QVariant option(ImageOption option) const
Reimplemented Function

◆ write()

bool QMngHandler::write ( const QImage image)
virtual

Reimplemented Function

Reimplemented from QImageIOHandler.

Definition at line 426 of file qmnghandler.cpp.

427 {
428  Q_D(QMngHandler);
429  return d->writeImage(image);
430 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482

Properties

◆ d_ptr

QScopedPointer<QMngHandlerPrivate> QMngHandler::d_ptr
private

Definition at line 78 of file qmnghandler_p.h.


The documentation for this class was generated from the following files: