Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Create new image from another image and rect ?  (Read 1823 times)

0 Members and 1 Guest are viewing this topic.

Haikarainen

  • Guest
Create new image from another image and rect ?
« 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?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Create new image from another image and rect ?
« Reply #1 on: April 23, 2011, 03:29:30 pm »
Take a look at the sf::Image::Copy() member function.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Haikarainen

  • Guest
Create new image from another image and rect ?
« Reply #2 on: April 23, 2011, 10:09:17 pm »
Quote from: "Nexus"
Take a look at the sf::Image::Copy() 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)