TextureBin Class

Inheritance diagram of TextureBin

class TextureBin(texture_width=256, texture_height=256)

Collection of texture atlases.

TextureBin maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.

Constructor:

__init__(texture_width=256, texture_height=256)

Create a texture bin for holding atlases of the given size.

Parameters:
  • texture_width (int) – Width of texture atlases to create.
  • texture_height (int) – Height of texture atlases to create.

Methods:

add(img) Add an image into this texture bin.

Methods

TextureBin.add(img)

Add an image into this texture bin.

This method calls TextureAtlas.add for the first atlas that has room for the image.

AllocatorException is raised if the image exceeds the dimensions of texture_width and texture_height.

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

Table Of Contents

Previous topic

TextureAtlas Class

Next topic

AllocatorException