SFML community forums

Help => General => Topic started by: Assassinbeast on October 21, 2012, 02:18:21 pm

Title: How do i make my bitmap transparent? sfml2.0
Post by: Assassinbeast on October 21, 2012, 02:18:21 pm
In 2.0 theres no "CreateMaskFromColor" from my textures.
So how do i make my background transparent if my images aint png files?
Title: Re: How do i make my bitmap transparent? sfml2.0
Post by: eXpl0it3r on October 21, 2012, 02:23:48 pm
It still exists, see here (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php#a22f13f8c242a6b38eb73cc176b37ae34). ;)

The thing is that texture.loadFromFile() actually is simply a shorthand for loading it into an image and then copying it to a texture.

So what you have to do is load it into a sf::Image set the wanted transparent color and retrieve the texture.

Another option would be to mask the background color in a image editor and set it to transparent. ;)
Title: Re: How do i make my bitmap transparent? sfml2.0
Post by: Assassinbeast on October 22, 2012, 12:06:38 am
It still exists, see here (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php#a22f13f8c242a6b38eb73cc176b37ae34). ;)

The thing is that texture.loadFromFile() actually is simply a shorthand for loading it into an image and then copying it to a texture.

So what you have to do is load it into a sf::Image set the wanted transparent color and retrieve the texture.

Another option would be to mask the background color in a image editor and set it to transparent. ;)


Ahh ok ty :)