TextureAtlas Class

Inheritance diagram of TextureAtlas

class TextureAtlas(width=256, height=256)

Collection of images within a texture.

Constructor:

__init__(width=256, height=256)

Create a texture atlas of the given size.

Parameters:
  • width (int) – Width of the underlying texture.
  • height (int) – Height of the underlying texture.

Methods:

add(img) Add an image to the atlas.

Methods

TextureAtlas.add(img)

Add an image to the atlas.

This method will fail if the given image cannot be transferred directly to a texture (for example, if it is another texture). ImageData is the usual image type for this method.

AllocatorException will be raised if there is no room in the atlas for the image.

Parameters:img (AbstractImage) – The image to add.
Return type:TextureRegion
Returns:The region of the atlas containing the newly added image.

Table Of Contents

Previous topic

Allocator Class

Next topic

TextureBin Class