Class pyglet.image.TextureRegion

AbstractImage --+    
                |    
          Texture --+
                    |
                   TextureRegion
Known Subclasses:
font.base.Glyph, TextureGrid
A rectangular region of a texture, presented as if it were a separate texture.

Methods

  __init__(self, x, y, z, width, height, owner)
ImageData get_image_data(self)
Get the image data of this texture.
AbstractImage get_region(self, x, y, width, height)
Retrieve a rectangular region of this image.
  blit_into(self, source, x, y, z)
Draw source on this image.
  __del__(self)
  __repr__(self) (Inherited from pyglet.image.AbstractImage)
  blit(self, x, y, z=0, width=None, height=None)
Draw this image to the active framebuffers.
(Inherited from pyglet.image.Texture)
  blit_to_texture(self, target, level, x, y, z=0)
Draw this image on the currently bound texture at target.
(Inherited from pyglet.image.AbstractImage)
Texture create(cls, width, height, internalformat=6408, rectangle=False, force_rectangle=False)
Create an empty Texture.
(Inherited from pyglet.image.Texture)
Texture create_for_size(cls, target, min_width, min_height, internalformat=None)
Create a Texture with dimensions at least min_width, min_height.
(Inherited from pyglet.image.Texture)
  delete(self)
Delete the texture from video memory.
(Inherited from pyglet.image.Texture)
Texture get_mipmapped_texture(self)
Retrieve a Texture instance with all mipmap levels filled in.
(Inherited from pyglet.image.AbstractImage)
Texture get_texture(self, rectangle=False, force_rectangle=False)
A Texture view of this image.
(Inherited from pyglet.image.Texture)
TextureRegion get_transform(self, flip_x=False, flip_y=False, rotate=0)
Create a copy of this image applying a simple transformation.
(Inherited from pyglet.image.Texture)
  save(self, filename=None, file=None, encoder=None)
Save this image to a file.
(Inherited from pyglet.image.AbstractImage)

Properties

ImageData image_data
An ImageData view of this texture.
(Inherited from pyglet.image.Texture)
Texture mipmapped_texture
A Texture view of this image.
(Inherited from pyglet.image.AbstractImage)
Texture texture
Get a Texture view of this image.
(Inherited from pyglet.image.AbstractImage)

Instance Variables

int anchor_x = 0
X coordinate of anchor, relative to left edge of image data
(Inherited from pyglet.image.AbstractImage)
int anchor_y = 0
Y coordinate of anchor, relative to bottom edge of image data
(Inherited from pyglet.image.AbstractImage)
int height
Height of image
(Inherited from pyglet.image.AbstractImage)
int level = 0
The mipmap level of this texture.
(Inherited from pyglet.image.Texture)
class (subclass of TextureRegion) region_class
Class to use when constructing regions of this texture.
(Inherited from pyglet.image.Texture)
int target
The GL texture target (e.g., GL_TEXTURE_2D).
(Inherited from pyglet.image.Texture)
tuple tex_coords = (0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0...
12-tuple of float, named (u1, v1, r1, u2, v2, r2, ...).
(Inherited from pyglet.image.Texture)
int width
Width of image
(Inherited from pyglet.image.AbstractImage)

Class Variables

  images = 1 (Inherited from pyglet.image.Texture)
  tex_coords_order = (0, 1, 2, 3) (Inherited from pyglet.image.Texture)
  x = 0 (Inherited from pyglet.image.Texture)
  y = 0 (Inherited from pyglet.image.Texture)
  z = 0 (Inherited from pyglet.image.Texture)

Method Details

__init__

(Constructor) __init__(self, x, y, z, width, height, owner)
Overrides:
Texture.__init__

get_image_data

get_image_data(self)

Get the image data of this texture.

Changes to the returned instance will not be reflected in this texture.

Returns: ImageData
Overrides:
Texture.get_image_data

Since: pyglet 1.1

get_region

get_region(self, x, y, width, height)
Retrieve a rectangular region of this image.
Returns: AbstractImage
Overrides:
Texture.get_region

blit_into

blit_into(self, source, x, y, z)

Draw source on this image.

source will be copied into this image such that its anchor point is aligned with the x and y parameters. If this image is a 3D texture, the z coordinate gives the image slice to copy into.

Note that if source is larger than this image (or the positioning would cause the copy to go out of bounds) then you must pass a region of source to this method, typically using get_region().

Overrides:
Texture.blit_into

__del__

(Destructor) __del__(self)
Overrides:
Texture.__del__