SharedImage Struct

struct Qul::SharedImage

Shared reference to image data. More...

Header: #include <qul/image.h>
Since: Qt Quick Ultralite 1.5

Public Functions

SharedImage(const Qul::SharedImage &other)
Qul::SharedImage &operator=(const Qul::SharedImage &other)
Qul::Image *image() const
Qul::PlatformInterface::Texture texture(int textureIndex = 0) const
int textureCount() const
bool operator bool() const

Detailed Description

This struct is used to pass memory buffers with image data to QUL elements for drawing. Properties like Image.source have the type Property<SharedImage>.

The most commonly used SharedImage values are built by the compiler for the image resources that are available at compile time and point to static memory areas.

You can use Image to allocate new image data on the heap or to import image data you have prepared separately. Image implicitly converts to SharedImage.

Note: The image() function may return NULL on SharedImage values generated by the compiler. Use operator bool() to determine if a SharedImage references image data.

See also Image.

Member Function Documentation

SharedImage::SharedImage(const Qul::SharedImage &other)

Copy constructor


Construct a null image reference.

Qul::SharedImage &SharedImage::operator=(const Qul::SharedImage &other)

Copy assignment from other



Qul::Image *SharedImage::image() const

Get associated Image, if available.

If this SharedImage was created from an Image, this returns a pointer to the image.

Note: Internally, Qt Quick Ultralite may create SharedImage instances that do not have an associated Image. In these cases this function returns NULL.

[since Qt Quick Ultralite 2.2] Qul::PlatformInterface::Texture SharedImage::texture(int textureIndex = 0) const

Returns the texture at textureIndex.

Valid index range is from 0 to textureCount() - 1.

Note: Function will trigger an error if the number of textures is zero.

This function was introduced in Qt Quick Ultralite 2.2.

See also SharedImage::textureCount.

[since Qt Quick Ultralite 2.2] int SharedImage::textureCount() const

Returns the number of textures associated with SharedImage.

Texture count might be higher than one if the split image optimization is enabled. To disable split image optimization set MCU.Config.Experimental.resourceSplitImageOptimization to false.

This function was introduced in Qt Quick Ultralite 2.2.

See also SharedImage::texture.

bool SharedImage::operator bool() const

Returns true if the SharedImage references some image data.

Available under certain Qt licenses.
Find out more.