SFML community forums
Help => Graphics => Topic started by: ScriptingTacos on October 19, 2015, 01:14:13 am
-
Hello!
I want to know if there is a way to replace one color with another in a texture. so for example say there is a texture that has a pink background which is meant to be replaced with a transparent color. Is this possible in SFML? I really don't want to use the getPixel() and setPixel() for the sprite.
-
It's possible once before loading it into a texture and it's called sf::Image::createMaskColor() (http://www.sfml-dev.org/documentation/2.3.2/classsf_1_1Image.php#a22f13f8c242a6b38eb73cc176b37ae34)
However personally I suggest you open your image editor and make the pink background actually transparent and save it as PNG. Today we don't really need color masks if we can have "real" transparent colors. ;)
-
Cool thanks!
Also I don't like making my sprite sheets with a transparent background. I don't know why. Anyways thanks again