Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » masked_blit problem

Credits go to Thomas Fjellstrom for helping out!
This thread is locked; no one can reply to it. rss feed Print
masked_blit problem
Brian Simpson
Member #6,645
December 2005
avatar

Ok, I have started up a simple pong clone for something to do, and I'm attempting to blit the title using masked blit.

media = load_datafile("media.dat");
 
masked_blit(media[TITLE].dat, screen, 0, 0, SCREEN_W/2 - 147, 25, 294, 54);
//TITLE is equal to 1, the number inside the dat file

The problem with this, is the pink is still showing. I'm not sure if I'm making a deadly obvious mistake, or there's something else wrong. I've tried changing the color depth from 8 to 16, 24, and 32 and they all just distort it and change it to bright silver like colors. Has anyone ever had a problem like this?

Thomas Fjellstrom
Member #476
June 2000
avatar

1. Make sure the datafile was loaded after set_gfx_mode
2. Make sure the colordepth was set before set_gfx_mode
3. Try calling set_color_conversion before you load the datafile (look at the COLORCONV_KEEP_TRANS option).

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Brian Simpson
Member #6,645
December 2005
avatar

I called set_color_depth(32) before I set the gfx mode and that did the trick. I thought you didn't have to set the color depth at all though. :-/

Thomas Fjellstrom
Member #476
June 2000
avatar

If you never set the color depth before set_gfx_mode allegro chooses 8bit. Always.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: