ColorBufferImage Class

Inheritance diagram of ColorBufferImage

class ColorBufferImage(x, y, width, height)

A color framebuffer.

This class is used to wrap both the primary color buffer (i.e., the back buffer) or any one of the auxiliary buffers.

Constructor:

__init__(x, y, width, height)

Methods:

blit(x, y[, z]) Draw this image to the active framebuffers.
blit_into(source, x, y, z) Draw source on this image.
blit_to_texture(target, level, x, y, z)
get_image_data()
get_mipmapped_texture() Retrieve a Texture instance with all mipmap levels filled in.
get_region(x, y, width, height)
get_texture([rectangle, force_rectangle])
save([filename, file, encoder]) Save this image to a file.

Attributes:

anchor_x Type: int
anchor_y Type: int
format Type: str
image_data An ImageData view of this image.
mipmapped_texture A Texture view of this image.
owner
texture Get a Texture view of this image.

Methods

ColorBufferImage.blit_to_texture(target, level, x, y, z)
ColorBufferImage.get_texture(rectangle=False, force_rectangle=False)

Attributes

ColorBufferImage.format = 'RGBA'

Inherited members

Methods

ColorBufferImage.blit(x, y, z=0)

Draw this image to the active framebuffers.

The image will be drawn with the lower-left corner at (x - anchor_x, y - anchor_y, z).

ColorBufferImage.blit_into(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().

ColorBufferImage.get_image_data()
ColorBufferImage.get_mipmapped_texture()

Retrieve a Texture instance with all mipmap levels filled in.

Requires that image dimensions be powers of 2.

Return type:Texture

Note

Since pyglet 1.1

ColorBufferImage.get_region(x, y, width, height)
ColorBufferImage.save(filename=None, file=None, encoder=None)

Save this image to a file.

Parameters:
  • filename (str) – Used to set the image file format, and to open the output file if file is unspecified.
  • file (file-like object or None) – File to write image data to.
  • encoder (ImageEncoder or None) – If unspecified, all encoders matching the filename extension are tried. If all fail, the exception from the first one attempted is raised.

Attributes

ColorBufferImage.anchor_x = 0
ColorBufferImage.anchor_y = 0
ColorBufferImage.image_data

An ImageData view of this image.

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

Warning

Deprecated. Use get_image_data.

Type:ImageData
ColorBufferImage.mipmapped_texture

A Texture view of this image.

The returned Texture will have mipmaps filled in for all levels. Requires that image dimensions be powers of 2. Read-only.

Warning

Deprecated. Use get_mipmapped_texture.

Type:Texture
ColorBufferImage.owner = None
ColorBufferImage.texture

Get a Texture view of this image.

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

Warning

Deprecated. Use get_texture.

Type:Texture

Table Of Contents

Previous topic

CheckerImagePattern Class

Next topic

CompressedImageData Class