C
ImageFiles.MCU.resourceImagePixelFormat
Set the preferred pixel format for the image assets.
Description
This property can be used to choose a pixel format for rendering image assets. Qt Quick Ultralite automatically chooses the optimal pixel format for the image, depending on the platform settings and image properties. the image pixel format can be changed to balance between the image output quality, its binary size, and memory footprint of an application.
Although the image quality is better with a higher bit depth, such an image requires more data to be stored in the application binary. This affects device flash usage, and also the RAM consumption depending on the resourceCachePolicy settings. On the other hand, using a lower bit depth results in worse image quality, but it has lower impact on the binary size and memory footprint.
Note: An image with the RGB332 pixel format is not rendered using hardware acceleration. This may result in sub-optimal application performance in terms of rendering speed (number of frames per second).
Using the SpriteLayer, ImageLayer, and ItemLayer QML types might require that an image pixel format should be selected for an image depending on the layer it's meant to be used with. On certain platforms (such as RH850), sprite layers require a compatible pixel format for all the items and image layers. If an opaque image is intended to be shown in a 16-bit item layer, it is not necessary to use 32-bit color depth for the image.
This property enables setting the preferred pixel format for an image. The selected pixel format must match the image content. For example, RGB888
format cannot be picked for an image with an alpha channel.
The RGB888RLE
, XRGB8888RLE
, and ARGB888RLE
pixel formats are dedicated to images that use the lossless run-length encoding (RLE) compression algorithm. Unlike images that use resource compression, these don't require additional storage and are decoded on the fly while rendering.
The AutomaticCompressedLossless
pixel format allows the resource compiler to automatically choose a format for lossless compression, based on the image content (opaque or transparent) and the platform default values (MCU.Config.platformAlphaCompressedLosslessResourcePixelFormat, MCU.Config.platformOpaqueCompressedLosslessResourcePixelFormat ).
Note: RGB888 is currently implemented in the same way as XRGB8888 (resources are 32-bit).
Usage
This property is accepted in any context where its parent node is accepted. It takes a string, and the default value is "Automatic"
.
The available options are:
"XRGB8888"
"RGB888"
"RGB565"
"RGB332"
"ARGB8888"
"ARGB4444"
"Alpha8"
"RGB888RLE"
"XRGB8888RLE"
"ARGB8888RLE"
"AutomaticCompressedLossless"
"Automatic"
Code example:
ImageFiles { MCU.resourceImagePixelFormat: "RGB332" }
Note: This property can also be applied to every image resource in the QmlProject file if defined in MCU.Config as follows:
MCU.Config { resourceImagePixelFormat: "RGB332" }
Since
This property was introduced in QmlProject API 1.3 .
See also QUL_RESOURCE_IMAGE_PIXEL_FORMAT.
Available under certain Qt licenses.
Find out more.