love.graphics.captureScreenshot (Русский)

Available since LÖVE 11.0
Эта функция заменяет love.graphics.newScreenshot.

Делает снимок экрана как только текущий кадр завершён (после завершения love.draw).

Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame.

O.png This function creates a new ImageData object and can cause love to slow down significantly if it's called every frame.  


Функция

Capture a screenshot and save it to a file at the end of the current frame.

Общий вид

love.graphics.captureScreenshot( filename )

Аргументы

string filename
The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats.

Возвращает

Ничего.

Функция

Capture a screenshot and call a callback with the generated ImageData at the end of the current frame.

Общий вид

love.graphics.captureScreenshot( callback )

Аргументы

function callback
Function which gets called once the screenshot has been captured. An ImageData is passed into the function as its only argument.

Возвращает

Ничего.

Функция

Capture a screenshot and push the generated ImageData to a Channel at the end of the current frame.

Общий вид

love.graphics.captureScreenshot( channel )

Аргументы

Channel channel
The Channel to push the generated ImageData to.

Возвращает

Ничего.

Примеры

Create a new screenshot and write it to the save directory.

function love.load()
    love.filesystem.setIdentity("screenshot_example")
end

function love.keypressed(key)
    if key == "c" then
        love.graphics.captureScreenshot(os.time() .. ".png")
    end
end

function love.draw()
    love.graphics.circle("fill", 400, 300, 200)
end

Смотрите также


Other Languages