![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QJp2Handler class provides support for reading and writing JPEG 2000 image files with the Qt plugin system. More...
#include <qjp2handler_p.h>
Public Member Functions | |
QJp2Handler () | |
Constructs an instance of QJp2Handler. | |
~QJp2Handler () | |
Destructor for QJp2Handler. | |
bool | canRead () const override |
\reimp | |
bool | read (QImage *image) override |
\reimp | |
bool | write (const QImage &image) override |
\reimp | |
QVariant | option (ImageOption option) const override |
Get the value associated with option. | |
void | setOption (ImageOption option, const QVariant &value) override |
The JPEG 2000 handler supports two options. | |
bool | supportsOption (ImageOption option) const override |
This function will return true if option is set to either QImageIOHandler::Quality or QImageIOHandler::Subtype. | |
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. | |
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 | 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 *iod, QByteArray *subType) |
Verifies if some values (magic bytes) are set as expected in the header of the file. | |
Static Public Member Functions inherited from QImageIOHandler | |
static bool | allocateImage (QSize size, QImage::Format format, QImage *image) |
The QJp2Handler class provides support for reading and writing JPEG 2000 image files with the Qt plugin system.
Currently, it only supports dynamically-loaded plugins.
JPEG files comes in two subtypes: the JPEG 2000 file format (.jp2) and the JPEG 2000 code stream format (
.j2k,
.jpc, or
.j2c). QJp2Handler can read and write both types.
To select a subtype, use the setOption() function with the QImageIOHandler::SubType option and a parameter value of "jp2" or "j2k".
To set the image quality when writing, you can use setOption() with the QImageIOHandler::Quality option, or QImageWriter::setQuality() if your are using a QImageWriter object to write the image. The image quality is specified as an int in the range 0 to 100. 0 means maximum compression and 99 means minimum compression. 100 selects lossless encoding, and this is the default value.
The JPEG handler is only available as a plugin, and this enables you to use normal QImage and QPixmap functions to read and write images. For example:
Definition at line 19 of file qjp2handler_p.h.
QJp2Handler::QJp2Handler | ( | ) |
Constructs an instance of QJp2Handler.
Definition at line 148 of file qjp2handler.cpp.
References QJp2Handler().
Referenced by QJp2Handler(), and QJp2Plugin::create().
QJp2Handler::~QJp2Handler | ( | ) |
Destructor for QJp2Handler.
Definition at line 156 of file qjp2handler.cpp.
|
overridevirtual |
\reimp
Implements QImageIOHandler.
Definition at line 193 of file qjp2handler.cpp.
References QImageReader::device().
|
static |
Verifies if some values (magic bytes) are set as expected in the header of the file.
If the magic bytes were found, we assume that we can read the file. The function will assume that the iod is pointing to the beginning of the JPEG 2000 header. (i.e. it will for instance not seek to the beginning of a file before reading).
If subType is not 0, it will contain "jp2" or "j2k" upon successful return.
Definition at line 171 of file qjp2handler.cpp.
|
overridevirtual |
Get the value associated with option.
Reimplemented from QImageIOHandler.
Definition at line 230 of file qjp2handler.cpp.
|
overridevirtual |
\reimp
Implements QImageIOHandler.
Definition at line 205 of file qjp2handler.cpp.
References Jpeg2000JasperReader::Jpeg2000JasperReader(), QImageReader::device(), and Jpeg2000JasperReader::read().
|
overridevirtual |
The JPEG 2000 handler supports two options.
Set option to QImageIOHandler::Quality to balance between quality and the compression level, where value should be an integer in the interval [0-100]. 0 is maximum compression (low quality) and 100 is lossless compression (high quality).
Set option to QImageIOHandler::Subtype to choose the subtype, where value should be a string equal to either "jp2" or "j2k"
Reimplemented from QImageIOHandler.
Definition at line 252 of file qjp2handler.cpp.
|
overridevirtual |
This function will return true if option is set to either QImageIOHandler::Quality or QImageIOHandler::Subtype.
Reimplemented from QImageIOHandler.
Definition at line 273 of file qjp2handler.cpp.
|
overridevirtual |
\reimp
Reimplemented from QImageIOHandler.
Definition at line 213 of file qjp2handler.cpp.
References Jpeg2000JasperReader::Jpeg2000JasperReader(), QImageReader::device(), J2kFormat, and Jp2Format.