Class pyglet.image.atlas.TextureBin

Collection of texture atlases.

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

Methods

  __init__(self, texture_width=256, texture_height=256)
Create a texture bin for holding atlases of the given size.
TextureRegion add(self, img)
Add an image into this texture bin.

Method Details

__init__

(Constructor) __init__(self, 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.

add

add(self, 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.
Returns:
TextureRegion: The region of an atlas containing the newly added image.