C

ImageDecoder Class

class Qul::PlatformInterface::ImageDecoder

The ImageDecoder class provides an abstract API to implement custom image decoders. More...

Header: #include <platforminterface/imagedecoder.h>
Since: Qt Quick Ultralite (Platform) 2.7

Public Types

Public Functions

virtual ~ImageDecoder()
virtual int decodeImage(Qul::PlatformInterface::ImageDecoder::RequestDataCallback &callback, unsigned char *outbuffer, uint32_t outbufferSize, Qul::PixelFormat pixelFormat, uint32_t requiredBytesPerLine) = 0
virtual bool imageInformation(Qul::PlatformInterface::ImageDecoder::RequestDataCallback &callback, int16_t *width, int16_t *height, Qul::PixelFormat *actualPixelFormat, Qul::PixelFormat optimalOpaquePixelFormat, Qul::PixelFormat optimalAlphaPixelFormat) = 0

Detailed Description

Creating a custom image decoder allows to use any image format as QML images. The Qt Quick Ultralite engine will check all registered image decoders for one that is capable of decoding the image.

See also Image decoder integration.

Member Function Documentation

[virtual] ImageDecoder::~ImageDecoder()

Destructs the image decoder instance.

[pure virtual] int ImageDecoder::decodeImage(Qul::PlatformInterface::ImageDecoder::RequestDataCallback &callback, unsigned char *outbuffer, uint32_t outbufferSize, Qul::PixelFormat pixelFormat, uint32_t requiredBytesPerLine)

Decodes the image data into the requested pixel format.

The image data can be read from callback and has to be decoded into the given outbuffer and outbufferSize. The requested pixelFormat was determined ahead of time by calling the imageInformation method. The decoder has to make sure that the requiredBytesPerLine is met, having to copy the lines with proper alignment if necessary.

On success the function has to return 0 otherwise 1.

[pure virtual] bool ImageDecoder::imageInformation(Qul::PlatformInterface::ImageDecoder::RequestDataCallback &callback, int16_t *width, int16_t *height, Qul::PixelFormat *actualPixelFormat, Qul::PixelFormat optimalOpaquePixelFormat, Qul::PixelFormat optimalAlphaPixelFormat)

Inspects the image properties.

Before fully decoding the image data, the QML engine will request properties about the image. callback provides the interface for this function to read data. When inspecting the data, the image type should be detected first. In case the data is not decodable by the decoder the funtion can immediately return false.

Its width and height have to be returned in the argurment pointers. optimalOpaquePixelFormat and optimalAlphaPixelFormat specify the optimal pixel format for the decoded image. Depending on the capabilities of the decoder and the actual image data, actualPixelFormat has to be set to the resulting pixel format that the decoder is able to provide.

True is returned when the functions succeeds, otherwise false.

See also ImageDecoder::RequestDataCallback.

Available under certain Qt licenses.
Find out more.