I agree with eXpl0it3r. If you want to understand the technique to manipulate pixels in an image, here is a code example.
Please note that you need a background.png image
#include <iostream>
#include <SFML/Graphics.hpp>
sf::Color setPixelColor(sf::Texture& texture, int x, int y, sf::Color color){
// Get texture image
sf::Image image = texture.copyToImage();
// Optional show case: read size of image (not used in this function)
int width = image.getSize().x;
int height = image.getSize().y;
// Get color of specific position
sf::Color imagecolor = image.getPixel(x, y);
// Just an example: if alpha is above 128, make it green
if (imagecolor.a > 128){
imagecolor.g = 255;
}
// Set pixel to color
image.setPixel(x, y, color);
// Update texture
texture.loadFromImage(image);
}
int main(){
sf::RenderWindow screen(sf::VideoMode(900, 600), "window");
sf::Sprite background;
sf::Texture texture;
if (!texture.loadFromFile("background.png")){
std::cout << "Error loading texture" << std::endl;
}
background.setTexture(texture);
while (screen.isOpen()){
sf::Event event;
while (screen.pollEvent(event)){
if (sf::Event::Closed == event.type){
screen.close();
break;
}
}
setPixelColor(texture, 10, 10, sf::Color::Green);
screen.clear();
screen.draw(background);
screen.display();
}
}