Sign in to follow this  
ISDCaptain01

How to deal with background transparency in sprites with Allegro 4?

Recommended Posts

ISDCaptain01    1496

I have a sprite with different background color. I want to blit this sprite into the game without its background color appearing. Is there a function to handle this type of situation in allegro 4? I know if the background is pink, it will not appear but how do I handle backgrounds of other colors?

 

Maybe something similar to this?

http://lazyfoo.net/SDL_tutorials/lesson05/index.php

Share this post


Link to post
Share on other sites
Crusable77    594

I do not know Allegro so I cannot answer your first question, but the second one I can. Where you would write in the rgb values of the magenta (255, 0, 255) you would replace it with the colour you are using.

 

Here is a website you can use as a reference: http://www.tayloredmktg.com/rgb/

Edited by Crusable

Share this post


Link to post
Share on other sites
LennyLen    5715


I don't think there is a way to change the mask color in Allegro 4

 

There isn't a function to change what the mask colour is, but you can change the Allegro source and recompile it to use whatever mask colour you want.

 

The mask colours are defined in the include/allegro/color.h file as such:

#define MASK_COLOR_8 0
#define MASK_COLOR_15 0x7C1F
#define MASK_COLOR_16 0xF81F
#define MASK_COLOR_24 0xFF00FF
#define MASK_COLOR_32 0xFF00FF

I've had to do this once before when I had sprites that actually contained magenta pixels.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this