Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 ISDCaptain01   Members   -  Reputation: 1371

Like
0Likes
Like

Posted 19 July 2013 - 12:29 PM

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



Sponsor:

#2 Crusable   Members   -  Reputation: 592

Like
0Likes
Like

Posted 19 July 2013 - 12:35 PM

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, 19 July 2013 - 12:36 PM.

"C spilled his beer all over C++'s shirt. Outraged, C++ shouted, "Good god, man! Have you no class?"

"Your mother is so fat that the recursive function that was used to calculate her mass created a stack overflow"

 

 


#3 Samuel Henderson   Members   -  Reputation: 148

Like
0Likes
Like

Posted 19 July 2013 - 01:36 PM

I don't think there is a way to change the mask color in Allegro 4.  Why not just convert the sprite's background to the magic pink? (255, 0, 255)?



#4 LennyLen   Crossbones+   -  Reputation: 3659

Like
0Likes
Like

Posted 21 July 2013 - 08:18 AM


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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS