SFML community forums

General => Feature requests => Topic started by: h2o202 on March 27, 2008, 02:23:07 pm

Title: Colorkeys for Drawables
Post by: h2o202 on March 27, 2008, 02:23:07 pm
I would like to have the possibility to set colorkeys to Drawables.
In SDL you can set a colorkey on Surfaces and every pixel which is colored like the set colorkey is not rendered when blitting the surface (so this pixels are transparent).
So you can draw Sprites in any form with a rectangular Image. I did not find this possibility in SFML.

I have many bitmaps with violet (255, 0, 255) backgrounds which I used in SDL. If I want to use them with SFML I don't know how to make the background unvisible.

whouldnt that be a very usefull feature?
Title: Colorkeys for Drawables
Post by: Avency on March 27, 2008, 03:46:16 pm
Why are you using bitmaps at all?
The easiest solution would be to add an alpha-channel to the images and save them as png or tga.
Title: Colorkeys for Drawables
Post by: Laurent on March 27, 2008, 04:21:04 pm
It already exists --> sf::Image::CreateMaskFromColor.

But I agree, setting a proper alpha chanel directly in the source image is much better.
Title: Colorkeys for Drawables
Post by: h2o202 on March 27, 2008, 04:55:38 pm
Im using bitmaps because I already have a big collection of bitmaps.

But you are right, I should convert them into newer formats.
But I will give sf::Image::CreateMaskFromColor a try.