love.graphics.readbackTexture

Available since LÖVE 12.0
It has replaced Canvas:newImageData.

Generates or updates ImageData from the contents of the given Texture.


Unlike love.graphics.readbackTextureAsync, this will not finish and return until the GPU finishes its own asynchronous work which may take a frame's worth of time or more.


O.png This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use this every frame, consider love.graphics.readbackTextureAsync instead.  


Function

Synopsis

data = love.graphics.readbackTexture( texture )

Arguments

Texture texture
The Texture to capture.

Returns

ImageData data
The new ImageData made from the Texture's contents.

Function

Synopsis

data = love.graphics.readbackTexture( texture, mipmap, x, y, width, height, dest, destx, desty )

Arguments

Texture texture
The Texture to capture.
number slice
The cubemap face index, array index, or depth layer for cubemap, array, or volume type Textures, respectively. This argument is ignored for regular 2D textures.
number mipmap (1)
The mipmap index to use, for Textures with mipmaps.
number x
The x-axis of the top-left corner (in pixels) of the area within the Texture to capture.
number y
The y-axis of the top-left corner (in pixels) of the area within the Texture to capture.
number width
The width in pixels of the area within the Texture to capture.
number height
The height in pixels of the area within the Texture to capture.
ImageData dest (nil)
Optional existing destination ImageData that will be used instead of creating a new ImageData object.
number destx (0)
The x-axis of the top-left corner (in pixels) of the area within the destination ImageData to use.
number desty (0)
The y-axis of the top-left corner (in pixels) of the area within the destination ImageData to use.

Returns

ImageData data
The new ImageData made from the Texture's contents, or the updated existing ImageData if one was given.

See Also


Other Languages