SFML community forums

Help => General => Topic started by: Birdron on December 06, 2019, 11:47:17 pm

Title: Saving Image Within A Rectangle
Post by: Birdron on December 06, 2019, 11:47:17 pm
Hi,
   There is a method RenderWindow::capture which save all window as an image. Is it possible to save just those images which are inside a rectangleShape?
   I have attached an image, I just want to save the inner area. Which is a rectangleShape.

Thank you
Title: Re: Saving Image Within A Rectangle
Post by: eXpl0it3r on December 07, 2019, 12:09:47 am
capture() is deprecated, instead you should be using texture.update(window) and then texture.copyToImage().

As for your question, not that's not directly supported. You can do it by either rendering to a render texture only the part you want to save, or you could only save a section of the sf::Image (e.g. use image.copy() and then save the copied image).