C

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

This class was introduced in 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 bytesPerPixel, int16_t bytesPerLine, const Private::TextureLayout *textureLayout = NULL)
int16_t bytesPerLine() const
int8_t bytesPerPixel() const
const unsigned char *data() const
const unsigned char *dataAtOffset(int16_t x, int16_t y) const
int flags() const
Qul::PixelFormat format() const
int16_t height() 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, bytesPerPixel and bytesPerLine.

Member Type Documentation

enum Texture::Flags

This enum type specifies various texture properties.

ConstantValueDescription
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 bytesPerPixel, int16_t bytesPerLine, const Private::TextureLayout *textureLayout = NULL)

Creates a texture object.

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

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

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 bytesPerPixel.

int8_t Texture::bytesPerPixel() const

Returns the number of bytes per pixel in the texture.

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

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.

const unsigned char *Texture::dataAtOffset(int16_t x, int16_t y) const

Returns a pointer to the texture data starting at x-offset x and y-offset y.

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.

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.