![]() |
Qt 6.x
The Qt SDK
|
#include <qpdfiohandler_p.h>
Public Member Functions | |
QPdfIOHandler () | |
~QPdfIOHandler () override | |
bool | canRead () const override |
Returns true if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false . | |
int | currentImageNumber () const override |
For image formats that support animation, this function returns the sequence number of the current image in the animation. | |
QRect | currentImageRect () const override |
Returns the rect of the current image. | |
int | imageCount () const override |
For image formats that support animation, this function returns the number of images in the animation. | |
bool | read (QImage *image) override |
Read an image from the device, and stores it in image. | |
QVariant | option (ImageOption option) const override |
Returns the value assigned to option as a QVariant. | |
void | setOption (ImageOption option, const QVariant &value) override |
Sets the option option with the value value. | |
bool | supportsOption (ImageOption option) const override |
Returns true if the QImageIOHandler supports the option option; otherwise returns false . | |
bool | jumpToImage (int frame) override |
For image formats that support animation, this function jumps to the image whose sequence number is imageNumber. | |
bool | jumpToNextImage () override |
For image formats that support animation, this function jumps to the next image. | |
![]() | |
QImageIOHandler () | |
Constructs a QImageIOHandler object. | |
virtual | ~QImageIOHandler () |
Destructs the QImageIOHandler object. | |
void | setDevice (QIODevice *device) |
Sets the device of the QImageIOHandler to device. | |
QIODevice * | device () const |
Returns the device currently assigned to the QImageIOHandler. | |
void | setFormat (const QByteArray &format) |
Sets the format of the QImageIOHandler to format. | |
void | setFormat (const QByteArray &format) const |
Sets the format of the QImageIOHandler to format. | |
QByteArray | format () const |
Returns the format that is currently assigned to QImageIOHandler. | |
virtual bool | canRead () const =0 |
Returns true if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false . | |
virtual bool | read (QImage *image)=0 |
Read an image from the device, and stores it in image. | |
virtual bool | write (const QImage &image) |
Writes the image image to the assigned device. | |
virtual QVariant | option (ImageOption option) const |
Returns the value assigned to option as a QVariant. | |
virtual void | setOption (ImageOption option, const QVariant &value) |
Sets the option option with the value value. | |
virtual bool | supportsOption (ImageOption option) const |
Returns true if the QImageIOHandler supports the option option; otherwise returns false . | |
virtual bool | jumpToNextImage () |
For image formats that support animation, this function jumps to the next image. | |
virtual bool | jumpToImage (int imageNumber) |
For image formats that support animation, this function jumps to the image whose sequence number is imageNumber. | |
virtual int | loopCount () const |
For image formats that support animation, this function returns the number of times the animation should loop. | |
virtual int | imageCount () const |
For image formats that support animation, this function returns the number of images in the animation. | |
virtual int | nextImageDelay () const |
For image formats that support animation, this function returns the number of milliseconds to wait until reading the next image. | |
virtual int | currentImageNumber () const |
For image formats that support animation, this function returns the sequence number of the current image in the animation. | |
virtual QRect | currentImageRect () const |
Returns the rect of the current image. | |
Static Public Member Functions | |
static bool | canRead (QIODevice *device) |
![]() | |
static bool | allocateImage (QSize size, QImage::Format format, QImage *image) |
Definition at line 23 of file qpdfiohandler_p.h.
QT_BEGIN_NAMESPACE QPdfIOHandler::QPdfIOHandler | ( | ) |
Definition at line 13 of file qpdfiohandler.cpp.
|
override |
Definition at line 17 of file qpdfiohandler.cpp.
|
overridevirtual |
Returns true
if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false
.
When reimplementing canRead(), make sure that the I/O device (device()) is left in its original state (e.g., by using peek() rather than read()).
Implements QImageIOHandler.
Definition at line 23 of file qpdfiohandler.cpp.
References canRead(), QImageIOHandler::device(), and QImageIOHandler::setFormat().
Referenced by canRead(), and QPdfPlugin::capabilities().
|
static |
Definition at line 36 of file qpdfiohandler.cpp.
References QImageIOHandler::device(), QIODevice::peek(), Q_UNLIKELY, and qstrncmp().
|
overridevirtual |
For image formats that support animation, this function returns the sequence number of the current image in the animation.
If this function is called before any image is read(), -1 is returned. The number of the first image in the sequence is 0.
If the image format does not support animation, 0 is returned.
Reimplemented from QImageIOHandler.
Definition at line 43 of file qpdfiohandler.cpp.
|
overridevirtual |
Returns the rect of the current image.
If no rect is defined for the image, and empty QRect() is returned.
This function is useful for animations, where only parts of the frame may be updated at a time.
Reimplemented from QImageIOHandler.
Definition at line 48 of file qpdfiohandler.cpp.
References QPdfDocument::pagePointSize(), and QSizeF::toSize().
|
overridevirtual |
For image formats that support animation, this function returns the number of images in the animation.
If the image format does not support animation, or if it is unable to determine the number of images, 0 is returned.
The default implementation returns 1 if canRead() returns true
; otherwise 0 is returned.
Reimplemented from QImageIOHandler.
Definition at line 53 of file qpdfiohandler.cpp.
References QImageIOHandler::device(), QPdfDocument::pageCount, qCDebug, and ret.
Referenced by jumpToImage().
|
overridevirtual |
For image formats that support animation, this function jumps to the image whose sequence number is imageNumber.
The next call to read() will attempt to read this image.
The default implementation does nothing, and returns false
.
Reimplemented from QImageIOHandler.
Definition at line 185 of file qpdfiohandler.cpp.
References frame, imageCount(), and qCDebug.
Referenced by jumpToNextImage().
|
overridevirtual |
For image formats that support animation, this function jumps to the next image.
The default implementation does nothing, and returns false
.
Reimplemented from QImageIOHandler.
Definition at line 194 of file qpdfiohandler.cpp.
References jumpToImage().
|
overridevirtual |
Returns the value assigned to option as a QVariant.
The type of the value depends on the option. For example, option(Size) returns a QSize variant.
Reimplemented from QImageIOHandler.
Definition at line 123 of file qpdfiohandler.cpp.
References QImageIOHandler::BackgroundColor, QImageIOHandler::ClipRect, QImageIOHandler::device(), QImage::Format_ARGB32_Premultiplied, QImageIOHandler::ImageFormat, QPdfDocument::metaData(), QImageIOHandler::Name, QPdfDocument::pagePointSize(), qMax(), QImageIOHandler::ScaledClipRect, QImageIOHandler::ScaledSize, QImageIOHandler::Size, and QPdfDocument::Title.
|
overridevirtual |
Read an image from the device, and stores it in image.
Returns true
if the image is successfully read; otherwise returns false.
For image formats that support incremental loading, and for animation formats, the image handler can assume that image points to the previous frame.
Implements QImageIOHandler.
Definition at line 62 of file qpdfiohandler.cpp.
References QImageIOHandler::device(), QImage::Format_ARGB32_Premultiplied, QSize::height(), QSizeF::height(), QSize::isEmpty(), QRect::isValid(), QSize::isValid(), QPdfDocument::pageCount, QPdfDocument::pagePointSize(), qCDebug, qWarning, QPdfDocument::render(), QColor::rgba(), QPdfDocumentRenderOptions::setScaledClipRect(), QPdfDocumentRenderOptions::setScaledSize(), QRect::size(), QRect::topLeft(), QSizeF::toSize(), QSize::width(), QSizeF::width(), QPoint::x(), xform, and QPoint::y().
|
overridevirtual |
Sets the option option with the value value.
Reimplemented from QImageIOHandler.
Definition at line 147 of file qpdfiohandler.cpp.
References QImageIOHandler::BackgroundColor, QImageIOHandler::ClipRect, QImageIOHandler::ScaledClipRect, QImageIOHandler::ScaledSize, and QColor::value().
|
overridevirtual |
Returns true
if the QImageIOHandler supports the option option; otherwise returns false
.
For example, if the QImageIOHandler supports the \l Size option, supportsOption(Size) must return true.
Reimplemented from QImageIOHandler.
Definition at line 167 of file qpdfiohandler.cpp.
References QImageIOHandler::BackgroundColor, QImageIOHandler::ClipRect, QImageIOHandler::ImageFormat, QImageIOHandler::Name, QImageIOHandler::ScaledClipRect, QImageIOHandler::ScaledSize, and QImageIOHandler::Size.