Texture Class

class Qul::PlatformInterface::Texture

A class containing information about a texture. More...

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

Public Types

enum Flags { NoTextureFlags, Swizzled, PartiallyOverlaps, NeedsCachedLoadFromSlowMemory, PaddedWithTransparency }

Public Functions

Texture(const unsigned char *data, Qul::PixelFormat format, int flags, int16_t width, int16_t height, int8_t bitsPerPixel, int16_t bytesPerLine, const Qul::Private::TextureLayout *textureLayout = NULL)
int8_t bitsPerPixel() const
int16_t bytesPerLine() const
const unsigned char *data() const
int flags() const
Qul::PixelFormat format() const
int16_t height() const
Qul::PlatformInterface::PixelDataPointer pixelData(int16_t x, int16_t y) const
Qul::PlatformInterface::Size size() const
int16_t width() const

Detailed Description

This class contains values needed to render a texture, meaning image data represented in some format adapted for fast display. The values include a data pointer, format specifier, texture flags, pixel format, width, height, bitsPerPixel and bytesPerLine.

Member Type Documentation

[since Qt Quick Ultralite (Platform) 1.5] enum Texture::Flags

This enum type specifies various texture properties.

Qul::PlatformInterface::Texture::NoTextureFlags0x00No flags set.
Qul::PlatformInterface::Texture::Swizzled0x01The texture data is swizzled, i.e. laid out in a non-linear way and needs hardware support to decode. This flag is only used on certain platforms that have swizzled texture format support, like Renesas RH850.
Qul::PlatformInterface::Texture::PartiallyOverlaps0x02The texture data might partially overlap with another texture. This might happen when an image is split into multiple sub-images in order to save space. If there's a split across an opaque region and the image is meant to be rotated or scaled, then each sub-image might be padded with the surrounding contents in order for bilinear filtering to produce the right visual output.
Qul::PlatformInterface::Texture::NeedsCachedLoadFromSlowMemory0x04This value is used internally by Qt Quick Ultralite and can be ignored in the platform implementations. It indicates that a texture needs copying from slow memory like flash to some faster memory before being used.
Qul::PlatformInterface::Texture::PaddedWithTransparency0x08This value specifies that the texture is padded with a border of transparency at least one pixel wide. This can be useful when rotating or scaling an image in order to use bilinear filtering to fade smoothly to transparent at the image edges. Note: This transparent padding is _outside_ of the texture bounds as given by width and height.

This enum was introduced or modified in Qt Quick Ultralite (Platform) 1.5.

See also Texture.

Member Function Documentation

Texture::Texture(const unsigned char *data, Qul::PixelFormat format, int flags, int16_t width, int16_t height, int8_t bitsPerPixel, int16_t bytesPerLine, const Qul::Private::TextureLayout *textureLayout = NULL)

Creates a texture object.

Creates a texture object with the given data, format, flags, width, height, bitsPerPixel, and bytesPerLine.

The textureLayout value is used by the fallback DrawingEngine to blend transformed images.

int8_t Texture::bitsPerPixel() const

Returns the number of bits per pixel in the texture.

Due to padding, the size of the texture might be bigger than width * height * 8 * bitsPerPixel.

int16_t Texture::bytesPerLine() const

Returns the number of bytes per line in the texture.

This includes any padding, so this value might be bigger than width multiplied by 8 * bitsPerPixel.

[since Qt Quick Ultralite (Platform) 1.5] const unsigned char *Texture::data() const

Returns a pointer to the memory containing the texture data.

This function was introduced in Qt Quick Ultralite (Platform) 1.5.

int Texture::flags() const

Returns an or'ed combination of flags from the Flags enum.

The flags describe the texture's special features, such as whether it has transparent padding.

Qul::PixelFormat Texture::format() const

Returns the pixel format of the texture data.

int16_t Texture::height() const

Returns height of the texture in pixels.

[since Qt Quick Ultralite (Platform) 1.9] Qul::PlatformInterface::PixelDataPointer Texture::pixelData(int16_t x, int16_t y) const

Returns a precise information about texture's pixel data location starting at x-pixel-offset x and y-pixel-offset y.

If texture's bits per pixel value is not a multiplication of a byte (8 bits), then actual data for pixel x, y may start somewhere else than at a full byte boundary, e.g. at bit 2 of byte 3. In such case, returned value of Qul::PlatformInterface::PixelDataPointer::bitOffset will be non-zero.

In general: pixel data starts at byte Qul::PlatformInterface::PixelDataPointer::address + Qul::PlatformInterface::PixelDataPointer::bitOffset bits.

This function was introduced in Qt Quick Ultralite (Platform) 1.9.

[since Qt Quick Ultralite (Platform) 1.7] Qul::PlatformInterface::Size Texture::size() const

Returns size of the texture in pixels.

This function was introduced in Qt Quick Ultralite (Platform) 1.7.

int16_t Texture::width() const

Returns width of the texture in pixels.

Available under certain Qt licenses.
Find out more.