SFML community forums

Help => Graphics => Topic started by: Haikarainen on April 23, 2011, 03:21:02 pm

Title: Create new image from another image and rect ?
Post by: Haikarainen on April 23, 2011, 03:21:02 pm
If i have:
sf::Image Image1;
sf::Rect rect(0,0,32,32);

sf::Image Image2;

How would i copy pixels from Image1 using the rect, into a new image on Image2?

So that Image2 contains the pixels in Image1 from 0 - 32 on both axes?
Title: Create new image from another image and rect ?
Post by: Nexus on April 23, 2011, 03:29:30 pm
Take a look at the sf::Image::Copy() (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.htm#ae641dca2acf27bcdc0fd562221907de6) member function.
Title: Create new image from another image and rect ?
Post by: Haikarainen on April 23, 2011, 10:09:17 pm
Quote from: "Nexus"
Take a look at the sf::Image::Copy() (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.htm#ae641dca2acf27bcdc0fd562221907de6) member function.


Thanks alot :) For those searching the forums with the same problem:
Remember you have to create the image first, with sf::Image::Create(int width, int height)