Page 1 of 1

cut out a part of a screen and draw it

Posted: Sat Nov 11, 2017 9:15 am
by Vrx8
so its like print screen/capture screen, but only at a specific part of the screen, like capturing half part of the screen, and then draw it.. is it possible ?

Re: cut out a part of a screen and draw it

Posted: Sat Nov 11, 2017 9:56 am
by Sir_Silver
You can use love.graphics.newScreenshot to capture imagedata of your love window, but nothing outside of it.

Re: cut out a part of a screen and draw it

Posted: Sat Nov 11, 2017 10:18 am
by zorg
If you do mean only a part of the game window/screen area contents though, then you can do it one of two ways:
- if you're specifically using a canvas there already, like for example, multiple small viewports in games like the settlers 2 or transport tycoon, then you can do that by getting the imagedata from the canvas itself;
- otherwise, you need to get the whole thing the way sir_silver said, and crop it after, probably by creating an ImageData with a smaller size, and using mapPixel on it.

Re: cut out a part of a screen and draw it

Posted: Sat Nov 11, 2017 12:20 pm
by bartbes
If you just want to draw it, can't you just the entire screen to a Canvas when you want to create the "screenshot", then draw part of that Canvas with a Quad?