Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » 8bit bitmap to alpha channel

This thread is locked; no one can reply to it. rss feed Print
8bit bitmap to alpha channel
HardTranceFan
Member #7,317
June 2006
avatar

Is there a quick method of writing the values of an 8bit bit map to the alpha channel of a 32bit bitmap, without changing the RGB components of the 32bit bitmap? Alternatively, is there a quick method of writing the alpha channel of a 32bit bitmap to the alpha channel of another 32bit bitmap without changing the RGB components of the second bitmap (the one being written to)?

[edit]
Worked it out :

//  image = 32 bit image, size of buffer == size of screen
//  trans = 8 bit image representing what the alpha channel on image should be

        drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0);
        set_write_alpha_blender();
        draw_trans_sprite(image, trans, tx, ty);
        set_alpha_blender();
        draw_trans_sprite(buffer, image, 0, 0);

[/edit]

--
"Shame your mind don't shine like your possessions do" - Faithless (I want more part 1)

Go to: