Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDDSHandler Class Reference

#include <qddshandler.h>

+ Inheritance diagram for QDDSHandler:
+ Collaboration diagram for QDDSHandler:

Public Member Functions

 QDDSHandler ()
 
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.
 
bool read (QImage *image) override
 Read an image from the device, and stores it in image.
 
bool write (const QImage &image) override
 Writes the image image to the assigned device.
 
QVariant option (QImageIOHandler::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 (QImageIOHandler::ImageOption option) const override
 Returns true if the QImageIOHandler supports the option option; otherwise returns false.
 
int imageCount () const override
 For image formats that support animation, this function returns the number of images in the animation.
 
bool jumpToImage (int imageNumber) override
 For image formats that support animation, this function jumps to the image whose sequence number is imageNumber.
 
- Public Member Functions inherited from QImageIOHandler
 QImageIOHandler ()
 Constructs a QImageIOHandler object.
 
virtual ~QImageIOHandler ()
 Destructs the QImageIOHandler object.
 
void setDevice (QIODevice *device)
 Sets the device of the QImageIOHandler to device.
 
QIODevicedevice () 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 jumpToNextImage ()
 For image formats that support animation, this function jumps to the next image.
 
virtual int loopCount () const
 For image formats that support animation, this function returns the number of times the animation should loop.
 
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 Public Member Functions inherited from QImageIOHandler
static bool allocateImage (QSize size, QImage::Format format, QImage *image)
 

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 , SupportedSubTypes ,
  OptimizedWrite , ProgressiveScanWrite , ImageTransformation
}
 This enum describes the different options supported by QImageIOHandler. More...
 
enum  Transformation {
  TransformationNone = 0 , TransformationMirror = 1 , TransformationFlip = 2 , TransformationRotate180 = TransformationMirror | TransformationFlip ,
  TransformationRotate90 = 4 , TransformationMirrorAndRotate90 = TransformationMirror | TransformationRotate90 , TransformationFlipAndRotate90 = TransformationFlip | TransformationRotate90 , TransformationRotate270 = TransformationRotate180 | TransformationRotate90
}
 
- Protected Member Functions inherited from QImageIOHandler
 QImageIOHandler (QImageIOHandlerPrivate &dd)
 
- Protected Attributes inherited from QImageIOHandler
QScopedPointer< QImageIOHandlerPrivated_ptr
 

Detailed Description

Definition at line 15 of file qddshandler.h.

Constructor & Destructor Documentation

◆ QDDSHandler()

QDDSHandler::QDDSHandler ( )

Definition at line 1340 of file qddshandler.cpp.

Member Function Documentation

◆ canRead() [1/2]

bool QDDSHandler::canRead ( ) const
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()).

See also
read(), QIODevice::peek()

Implements QImageIOHandler.

Definition at line 1349 of file qddshandler.cpp.

References canRead(), QImageIOHandler::device(), QByteArrayLiteral, and QImageIOHandler::setFormat().

Referenced by canRead(), and QDDSPlugin::capabilities().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canRead() [2/2]

bool QDDSHandler::canRead ( QIODevice * device)
static

Definition at line 1494 of file qddshandler.cpp.

References QImageIOHandler::device(), QIODevice::isSequential(), QIODevice::peek(), QByteArrayLiteral, and qWarning.

+ Here is the call graph for this function:

◆ imageCount()

int QDDSHandler::imageCount ( ) const
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 1477 of file qddshandler.cpp.

References DDSHeader::mipMapCount.

Referenced by jumpToImage().

+ Here is the caller graph for this function:

◆ jumpToImage()

bool QDDSHandler::jumpToImage ( int imageNumber)
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 1485 of file qddshandler.cpp.

References imageCount().

+ Here is the call graph for this function:

◆ option()

QVariant QDDSHandler::option ( QImageIOHandler::ImageOption option) const
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.

See also
setOption(), supportsOption()

Reimplemented from QImageIOHandler.

Definition at line 1441 of file qddshandler.cpp.

References FormatA8R8G8B8, formatName(), QVariant::fromValue(), DDSHeader::height, QImageIOHandler::Size, QImageIOHandler::SubType, QImageIOHandler::SupportedSubTypes, supportsOption(), and DDSHeader::width.

+ Here is the call graph for this function:

◆ read()

bool QDDSHandler::read ( QImage * image)
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.

See also
canRead()

Implements QImageIOHandler.

Definition at line 1362 of file qddshandler.cpp.

References QImageIOHandler::device(), headerSize, isCubeMap(), QDataStream::LittleEndian, mipmapOffset(), ok, pos, readCubeMap(), and readTexture().

+ Here is the call graph for this function:

◆ setOption()

void QDDSHandler::setOption ( QImageIOHandler::ImageOption option,
const QVariant & value )
overridevirtual

Sets the option option with the value value.

See also
option(), ImageOption

Reimplemented from QImageIOHandler.

Definition at line 1460 of file qddshandler.cpp.

References formatByName(), FormatUnknown, qWarning, QImageIOHandler::SubType, and QByteArray::toUpper().

+ Here is the call graph for this function:

◆ supportsOption()

bool QDDSHandler::supportsOption ( QImageIOHandler::ImageOption option) const
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.

See also
setOption(), option()

Reimplemented from QImageIOHandler.

Definition at line 1470 of file qddshandler.cpp.

References QImageIOHandler::Size, QImageIOHandler::SubType, and QImageIOHandler::SupportedSubTypes.

Referenced by option().

+ Here is the caller graph for this function:

◆ write()

bool QDDSHandler::write ( const QImage & image)
overridevirtual

Writes the image image to the assigned device.

Returns true on success; otherwise returns false.

The default implementation does nothing, and simply returns false.

Reimplemented from QImageIOHandler.

Definition at line 1383 of file qddshandler.cpp.

References DDSHeader::CapsTexture, ddsMagic, QImageIOHandler::device(), DDSPixelFormat::FlagAlphaPixels, DDSHeader::FlagCaps, DDSHeader::FlagHeight, DDSHeader::FlagPixelFormat, DDSPixelFormat::FlagRGB, DDSHeader::FlagWidth, QImage::Format_ARGB32, FormatA8R8G8B8, formatName(), i, QDataStream::LittleEndian, DDSHeader::magic, qAlpha(), qBlue(), qGreen(), qRed(), QRgb, qWarning, red, and DDSHeader::ReservedCount.

+ Here is the call graph for this function:

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