Archived

This topic is now archived and is closed to further replies.

Allegro Noob

This topic is 5131 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve decided to try out Allegro after having no luck with SDL. I was just wondering how to change parts of a bitmap to transparent... eg. Is there a way to make the bitmap objects RGBA instead of just RGB???

Share this post


Link to post
Share on other sites
RGBA is more for opacity than for transparency, you use alpha when you want something semi-transparent. As i can see, what you want is colorkeying which mean you want to associate one color of the bitmap to a transparent pixel for non-rectangle sprites. In the Allegro API documentation it is written that for 8bits bitmap, the color key is 0 and for truecolor it is RGB(255, 0, 255) (bright pink). To make your bitmap use the color key, simply use the function

masked_blit(BITMAP *source, BITMAP *dest, int src_x,
int src_y, int dest_x, int dest_y, int width, int height);
// or
masked_stretch_blit(BITMAP *source, BITMAP *dest, int src_x,
int src_y, int src_w, int src_h, int dest_x, int dest_y,
int dest_w, int dest_h);

instead of

blit(BITMAP *source, BITMAP *dest, int src_x, int src_y,
int dest_x, int dest_y, int width, int height);


hope that helps !
Matt

[edited by - lemurion on November 28, 2003 8:02:41 AM]

Share this post


Link to post
Share on other sites