SFML community forums
Help => Graphics => Topic started by: panithadrum on February 18, 2010, 11:02:16 pm
-
I'm having problems copying an image to another.
sf::Image texture;
if(!texture.LoadFromFile(fname)) return false;
sf::Image subtexture;
subtexture.Copy(texture, 0, 0, sf::IntRect(x, y, width, height), true);
Console shows that I am trying to access an empty image, but texture was successfull loaded... I am using SFML2, last version, W7.
Any idea why?
-
subtexture is empty.
I think that copy requires the target image to have enough space to paste the source area being copied.
Edit: Ok, looking at SFML code, as I though, copy doesn't change target size, it copies what it can to the target. Since target is empty, it just returns.
Aren't you trying to access subtexture pixels later (which is empty)?
-
Hmm that makes sense. It's solved now. Maybe documentation needs some details to be added :oops:
-
Many things in the documentation need more details ;)