Class: QgsTextureAtlasGenerator

Generates texture atlases by efficient packing of multiple input rectangles/images.

QgsTextureAtlasGenerator can be used to pack either images or raw rectangles. The static createFromRects() or createFromImages() methods should be called with the source images or rectangles, which will return a QgsTextureAtlas containing the results.

Added in version 4.0.

Static Methods

createFromImages

Creates a texture atlas for a set of images.

createFromRects

Creates a texture atlas for a set of rectangles.

class qgis._3d.QgsTextureAtlasGenerator[source]

Bases: object

static createFromImages(images: Iterable[QImage], maxSide: int = 1000) QgsTextureAtlas[source]

Creates a texture atlas for a set of images.

The maxSide argument specifies the maximum permitted side size for the atlas. The calculated solution can only be less than or equal to this size - if it cannot fit, then algorithm will gracefully fail and return an invalid QgsTextureAtlas.

Parameters:
  • images (Iterable[QImage])

  • maxSide (int = 1000)

Return type:

QgsTextureAtlas

static createFromRects(rectangles: Iterable[QRect], maxSide: int = 1000) QgsTextureAtlas[source]

Creates a texture atlas for a set of rectangles.

This method should be used when the generator is used to pack rectangle shapes only. No image will be associated with the rectangle.

The maxSide argument specifies the maximum permitted side size for the atlas. The calculated solution can only be less than or equal to this size - if it cannot fit, then algorithm will gracefully fail and return an invalid QgsTextureAtlas.

Parameters:
  • rectangles (Iterable[QRect])

  • maxSide (int = 1000)

Return type:

QgsTextureAtlas