Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » fblend fade with magic pink

This thread is locked; no one can reply to it. rss feed Print
fblend fade with magic pink
Neil Walker
Member #210
April 2000
avatar

Hello,
Is there a way to use fblend_fade_to_color while keeping the magic pink colour?

In standard allegro you can simply do something like this for a fade, e.g.

  set_trans_blender(0,0,0, somevalue);
  draw_trans_sprite(bmp1,bmp2, 0,0);

and the magic pink is preserved. However if you do

  fblend_fade_to_color(bmp2, bmp1, 0,0, colour1, somevalue);

It does a complete fade, ignoring the magic pink. What you have to do (unless I'm completely wrong) is you have to do is check the original untouched bitmap for mask colour pixels and put them back into the faded bitmap (repeating/checking each bitmap depth):

  if(ColourDepth==32)
  {
    acquire_bitmap(bmp2);
    for(int i=0;i<w;i++)
    {
      for(int j=0;j<w;j++)
      {
        FadeColour=_getpixel32(bmp1, i, j);
        if(FadeColour==MASK_COLOR_32)
          _putpixel32(bmp2,i,j,MASK_COLOR_32);
      }
    }
    release_bitmap(bmp2);

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Go to: