SDL and 1-bit masks

Hello everyone,

I am in charge of porting a game from MAc OS to Windows and to Linux. I thought that the easiest way to do this would be rewriting it in SDL. However, I have a smal problem. The graphics for the Macintosh version were given in the Macintosh standard way of doing sprites, i.e. a color stencil, and its black and white mask. From all the examples and code I’ve found I can see that the way they do sprites in windows and in SDL is by painting the background of the image in a different color.

My question is, is it possible to do sprites in SDL using a colour image and its respective black and white mask ? If so, how would you do it?

Thank you,

Pancho

Hello everyone,

I am in charge of porting a game from MAc OS to Windows and to Linux. I thought that the easiest way to do this would be rewriting it in SDL. However, I have a smal problem. The graphics for the Macintosh version were given in the Macintosh standard way of doing sprites, i.e. a color stencil, and its black and white mask. From all the examples and code I’ve found I can see that the way they do sprites in windows and in SDL is by painting the background of the image in a different color.

My question is, is it possible to do sprites in SDL using a colour image and its respective black and white mask ? If so, how would you do it?

There are a couple of ways of doing this. The most efficient is converting
your graphics so they use a colorkey in the areas which are masked out.

BTW, the reason SDL uses colorkey instead of a mask, is because a colorkey
can be hardware accelerated on more platforms, is built into several image
formats, and can be converted to a mask easily.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment