|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
Decodes image data using Qt's built-in image loading capabilities. More...
#include <image_decoder.h>
Signals | |
| void | error (const QString &message) |
| Emitted if an error occurs during image loading or decoding. | |
| void | imageInfo (int width, int height, bool has_alpha) |
| Emitted after successful decoding, providing basic image information. | |
| void | imageReady (const QImage &image) |
| Emitted when the image has been successfully decoded. | |
Public Member Functions | |
| QImage | Decode () |
| Attempts to decode the image data stored internally. Uses QImage::loadFromData() to perform the decoding. Emits imageReady() and imageInfo() on success, or error() on failure. | |
| ImageDecoder (const QByteArray &image_data, QObject *parent=nullptr) | |
| Constructs an ImageDecoder object. | |
| ~ImageDecoder () override | |
| Destructor. Does not require special resource management like FFmpeg-based decoders. | |
Static Public Member Functions | |
| static void | ReleaseResources () |
| Static method placeholder for resource release. In this Qt-based implementation, there are no specific resources to release globally. | |
Private Attributes | |
| QByteArray | image_data_ |
| Stores the raw image data provided in the constructor. | |
Decodes image data using Qt's built-in image loading capabilities.
This class takes raw image data (e.g., PNG, JPEG, etc.) as a QByteArray and uses QImage::loadFromData() to decode it. It operates synchronously within the calling thread and emits signals to report the decoded image, image information, or errors.
|
inlineexplicit |
Constructs an ImageDecoder object.
| image_data | The raw image data to be decoded. |
| parent | Optional parent QObject. |
|
inlineoverride |
Destructor. Does not require special resource management like FFmpeg-based decoders.
| QImage ImageDecoder::Decode | ( | ) |
Attempts to decode the image data stored internally. Uses QImage::loadFromData() to perform the decoding. Emits imageReady() and imageInfo() on success, or error() on failure.
|
signal |
Emitted if an error occurs during image loading or decoding.
| message | A description of the error. |
|
signal |
Emitted after successful decoding, providing basic image information.
| width | The width of the decoded image in pixels. |
| height | The height of the decoded image in pixels. |
| has_alpha | True if the image format supports an alpha channel, false otherwise. |
|
signal |
Emitted when the image has been successfully decoded.
| image | The decoded image as a QImage object. A copy is emitted. |
|
inlinestatic |
Static method placeholder for resource release. In this Qt-based implementation, there are no specific resources to release globally.
|
private |
Stores the raw image data provided in the constructor.