|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QImageIOHandler
public abstract class QImageIOHandler
The QImageIOHandler class defines the common image I/O interface for all image formats in Qt. Qt uses QImageIOHandler for reading and writing images through QImageReader
and QImageWriter
. You can also derive from this class to write your own image format handler using Qt's plugin mechanism.
Call setDevice()
to assign a device to the handler, and setFormat()
to assign a format to it. One QImageIOHandler may support more than one image format. canRead()
returns true if an image can be read from the device, and read()
and write()
return true if reading or writing an image was completed successfully.
QImageIOHandler also has support for animations formats, through the functions loopCount()
, imageCount()
, nextImageDelay()
and currentImageNumber()
.
In order to determine what options an image handler supports, Qt will call supportsOption()
and setOption()
. Make sure to reimplement these functions if you can provide support for any of the options in the ImageOption
enum.
To write your own image handler, you must at least reimplement canRead()
and read()
. Then create a QImageIOPlugin
that can create the handler. Finally, install your plugin, and QImageReader
and QImageWriter
will then automatically load the plugin, and start using it.
QImageIOPlugin
, QImageReader
, and QImageWriter
.
Nested Class Summary | |
---|---|
static class |
QImageIOHandler.ImageOption
This enum describes the different options supported by QImageIOHandler . |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QImageIOHandler()
Constructs a QImageIOHandler object. |
Method Summary | |
---|---|
abstract boolean |
canRead()
Returns true if an image can be read from the device (i. |
int |
currentImageNumber()
For image formats that support animation, this function returns the sequence number of the current image in the animation. |
QRect |
currentImageRect()
Returns the rect of the current image. |
QIODevice |
device()
Returns the device currently assigned to the QImageIOHandler. |
QByteArray |
format()
Returns the format that is currently assigned to QImageIOHandler. |
int |
imageCount()
For image formats that support animation, this function returns the number of images in the animation. |
boolean |
jumpToImage(int imageNumber)
For image formats that support animation, this function jumps to the image whose sequence number is imageNumber. |
boolean |
jumpToNextImage()
For image formats that support animation, this function jumps to the next image. |
int |
loopCount()
For image formats that support animation, this function returns the number of times the animation should loop. |
int |
nextImageDelay()
For image formats that support animation, this function returns the number of milliseconds to wait until reading the next image. |
java.lang.Object |
option(QImageIOHandler.ImageOption option)
Returns the value assigned to option as a QVariant . |
abstract boolean |
read(QImage image)
Read an image from the device, and stores it in image. |
void |
setDevice(QIODevice device)
Sets the device of the QImageIOHandler to device. |
void |
setFormat(QByteArray format)
Sets the format of the QImageIOHandler to format. |
void |
setOption(QImageIOHandler.ImageOption option,
java.lang.Object value)
Sets the option option with the value value. |
boolean |
supportsOption(QImageIOHandler.ImageOption option)
Returns true if the QImageIOHandler supports the option option; otherwise returns false. |
boolean |
write(QImage image)
Writes the image image to the assigned device. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QImageIOHandler()
Method Detail |
---|
public final QIODevice device()
setDevice()
.
public final QByteArray format()
setFormat()
.
public final void setDevice(QIODevice device)
The device can only be set once and must be set before calling canRead()
, read()
, write()
, etc. If you need to read multiple files, construct multiple instances of the appropriate QImageIOHandler subclass.
device()
.
public final void setFormat(QByteArray format)
format()
.
public abstract boolean canRead()
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()
).
read()
, and QIODevice::peek()
.
public int currentImageNumber()
public QRect currentImageRect()
This function is useful for animations, where only parts of the frame may be updated at a time.
public int imageCount()
The default implementation returns 1 if canRead()
returns true; otherwise 0 is returned.
public boolean jumpToImage(int imageNumber)
read()
will attempt to read this image. The default implementation does nothing, and returns false.
public boolean jumpToNextImage()
The default implementation does nothing, and returns false.
public int loopCount()
public int nextImageDelay()
public java.lang.Object option(QImageIOHandler.ImageOption option)
QVariant
. The type of the value depends on the option. For example, option(Size) returns a QSize
variant. setOption()
, and supportsOption()
.
public abstract boolean read(QImage image)
For image formats that support incremental loading, and for animation formats, the image handler can assume that image points to the previous frame.
canRead()
.
public void setOption(QImageIOHandler.ImageOption option, java.lang.Object value)
option()
, and ImageOption
.
public boolean supportsOption(QImageIOHandler.ImageOption option)
Size
option, supportsOption(Size) must return true. setOption()
, and option()
.
public boolean write(QImage image)
The default implementation does nothing, and simply returns false.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |