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.
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.
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.
- 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().
Retrieve a Texture instance with all mipmap levels filled in.
Requires that image dimensions be powers of 2.
Return type: Texture
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.
- 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.
- ColorBufferImage.anchor_x = 0
- ColorBufferImage.anchor_y = 0
An ImageData view of this image.
Changes to the returned instance may or may not be reflected in this image. Read-only.
Deprecated. Use get_image_data.
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.
Deprecated. Use get_mipmapped_texture.
- ColorBufferImage.owner = None
Get a Texture view of this image.
Changes to the returned instance may or may not be reflected in this image.
Deprecated. Use get_texture.