getScreenshot

getScreenshot()

Creates and returns a copy of the screen. This is an Image object, with all of the screen drawn to it.

This can be useful for implementing blurs, and other effects.

Advanced Example

Draws a large pink circle to the screen, underneath the mouse. A blur is added, using getScreenshot to save and redraw old frames.

last = getScreenshot()

onEachFrame() do
    fill( :white )
    
    setAlpha( 0.85 ) do
        drawImage( last, 0, 0 )
    end
    
    c = getControls()
    setColor( :pink, 1 ) do
        fillCircle( c.getMouseX(), c.getMouseY(), 100, true )
    end
    
    last = getScreenshot()
end

See also

Image-Class