Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Colorkeys for Drawables  (Read 16039 times)

0 Members and 1 Guest are viewing this topic.

h2o202

  • Newbie
  • *
  • Posts: 4
    • View Profile
Colorkeys for Drawables
« 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?
Sorry, My english is not so good ^^

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
Colorkeys for Drawables
« Reply #1 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Colorkeys for Drawables
« Reply #2 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.
Laurent Gomila - SFML developer

h2o202

  • Newbie
  • *
  • Posts: 4
    • View Profile
Colorkeys for Drawables
« Reply #3 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.
Sorry, My english is not so good ^^

 

anything