Is there any way to access the pixels of images and textures in CSFML without using setPixel, getPixel or sfImage_getPixelsPtr ?
Can I access the sfImage struct to get the pixels in CSFML or do I have to use the C++ SFML?
I'm asking this because sfImage_copyImage is not working the way I wanted.
For example I want to copy a "tile" (8x8 pixels) from a big image to a smaller one.
The following code should take the first 8x8 tile, (from 0,0 to 8,8 of the big image) and paste it to the top part of the small image.
sfImage_copyImage(Small_Image,Big_Image, 0, 0, (const sfIntRect){0, 0, 8, 8}, 0);
In my case, this just pastes the big image on top of the small one, ignoring the pixels that don't fit on the small image like a photoshop paste
.
Maybe I'm using the sfImage_copyImage the wrong way?
Thanks!
EDIT: I really don't know why... But it worked inside a loop
int x = 0;int y = 0;int i = 0;
for (y = 0; y < 128; y+= 8){
for (x = 0; x < 128; x+= 8){
sfImage_copyImage(Tileset,New_Tileset, 0, i, (const sfIntRect){x, y, 8, 8}, 0);
i+= 8;
}
}
It loads all tiles correctly from a 128x128 image.
(I'm sorry I should have posted this in the graphics section).