cut out a part of a screen and draw it

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Vrx8
Prole
Posts: 20
Joined: Sat Jun 17, 2017 5:35 am

cut out a part of a screen and draw it

Post 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 ?
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

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

Post by Sir_Silver »

You can use love.graphics.newScreenshot to capture imagedata of your love window, but nothing outside of it.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests