# Class pyglet.image.CompressedImageData

    AbstractImage --+
                    |
                   CompressedImageData

Image representing some compressed data suitable for direct uploading to driver.

## Methods

| __init__(self, width, height, gl_format, data, extension=None, decoder=None) Construct a CompressedImageData with the given compressed data.
| set_mipmap_data(self, level, data) Set data for a mipmap level.
Texture | get_texture(self, rectangle=False) A Texture view of this image.
Texture | get_mipmapped_texture(self) Retrieve a Texture instance with all mipmap levels filled in.
| blit_to_texture(self, target, level, x, y, z) Draw this image on the currently bound texture at `target`.
| __repr__(self) (Inherited from pyglet.image.AbstractImage)
| blit(self, x, y, z=0) Draw this image to the active framebuffers. (Inherited from pyglet.image.AbstractImage)
| blit_into(self, source, x, y, z) Draw `source` on this image. (Inherited from pyglet.image.AbstractImage)
ImageData | get_image_data(self) Get an ImageData view of this image. (Inherited from pyglet.image.AbstractImage)
AbstractImage | get_region(self, x, y, width, height) Retrieve a rectangular region of this image. (Inherited from pyglet.image.AbstractImage)
| 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 image. (Inherited from pyglet.image.AbstractImage)
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 | width Width of image (Inherited from pyglet.image.AbstractImage)

## Method Details

### __init__

(Constructor) __init__(self, width, height, gl_format, data, extension=None, decoder=None)
Construct a CompressedImageData with the given compressed data.

Parameters:
  width : int
    Width of image
  height : int
    Height of image
  gl_format : int
    GL constant giving format of compressed data; for example, `GL_COMPRESSED_RGBA_S3TC_DXT5_EXT`.
  data : sequence
    String or array/list of bytes giving compressed image data.
  extension : str or None
    If specified, gives the name of a GL extension to check for before creating a texture.
  decoder : function(data, width, height) -> AbstractImage
    A function to decode the compressed data, to be used if the required extension is not present.
Overrides:
  AbstractImage.__init__

### set_mipmap_data

set_mipmap_data(self, level, data)

Set data for a mipmap level.

Supplied data gives a compressed image for the given mipmap level. The image must be of the correct dimensions for the level (i.e., width >> level, height >> level); but this is not checked. If any mipmap levels are specified, they are used; otherwise, mipmaps for mipmapped_texture are generated automatically.

Parameters:
  level : int
    Level of mipmap image to set.
  data : sequence
    String or array/list of bytes giving compressed image data. Data must be in same format as specified in constructor.

### get_texture

get_texture(self, rectangle=False)

A Texture view of this image.

By default, textures are created with dimensions that are powers of two. Smaller images will return a TextureRegion that covers just the image portion of the larger texture. This restriction is required on older video cards, and for compressed textures, or where texture repeat modes will be used, or where mipmapping is desired.

If the `rectangle` parameter is `True`, this restriction is ignored and a texture the size of the image may be created if the driver supports the `GL_ARB_texture_rectangle` or `GL_NV_texture_rectangle` extensions. If the extensions are not present or the image already is a texture, the `rectangle` parameter is ignored.

Examine Texture.target to determine if the returned texture is a rectangle (`GL_TEXTURE_RECTANGLE_ARB` or `GL_TEXTURE_RECTANGLE_NV`) or not (`GL_TEXTURE_2D`).

Changes to the returned instance may or may not be reflected in this image.

Returns: Texture
Overrides:
  AbstractImage.get_texture

Since: pyglet 1.1

### get_mipmapped_texture

get_mipmapped_texture(self)

Retrieve a Texture instance with all mipmap levels filled in.

Requires that image dimensions be powers of 2.

Returns: Texture
Overrides:
  AbstractImage.get_mipmapped_texture

Since: pyglet 1.1

### blit_to_texture

blit_to_texture(self, target, level, x, y, z)

Draw this image on the currently bound texture at `target`.

This image is copied into the texture such that this image's anchor point is aligned with the given `x` and `y` coordinates of the destination texture. If the currently bound texture is a 3D texture, the `z` coordinate gives the image slice to blit into.

Overrides:
  AbstractImage.blit_to_texture