![]() |
|
Alpha Channel |
Mariusz
Member #1,634
November 2001
|
Can anyone help me out with alpha channel issue? I have created an image using PS5.5 and made an alpha channel for my selection. As a next step, I have saved this image as a Targa (TGA) format including alpha channel. My question is how do I load this image back to my Allegro project? I want to display it over other backgrounds so it would create transparency in the areas where it should. I have seen some DirectX demos a while ago where a particle system would be using some alpha channels (it looked really nice.) I would really appreciate if someone had a link or an example of how to accomplish alpha channel within the Allegro. Best regards, |
Steve Terry
Member #1,989
March 2002
![]() |
bmp = load_bmp("blah.tga", NULL); I mean it's not hard ___________________________________ |
Oscar Giner
Member #2,207
April 2002
![]() |
To load the image you must be sure that it's loaded in a 32bpp bitmap. For that, you have to disable color conversion: set_color_conversion(COLORCONV_NONE); image_with_alpha = load_bitmap("file.tga", NULL); set_color_conversion(COLORCONV_TOTAL); To blit you just have to enable alpha blending: drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0); set_alpha_blender(); // blit the alpha image solid_mode(); [edit] Quote: set_alpha_channel();
Steve, you just made that up, didn't you? -- |
Steve Terry
Member #1,989
March 2002
![]() |
>_< I had alpha channel in my mind when I wrote that... it's a typo yes ___________________________________ |
Mariusz
Member #1,634
November 2001
|
Thank you guys so much! This is one of the best places to get some answers :-) |
Steve Terry
Member #1,989
March 2002
![]() |
You better believe it ___________________________________ |
Mariusz
Member #1,634
November 2001
|
Worked like a charm |
Thomas Fjellstrom
Member #476
June 2000
![]() |
WE rule, and GameDev drools -- |
Gideon Weems
Member #3,925
October 2003
|
Oscar Giner
Member #2,207
April 2002
![]() |
I wouldn't look much to Steve's code -- |
Steve Terry
Member #1,989
March 2002
![]() |
___________________________________ |
Oscar Giner
Member #2,207
April 2002
![]() |
Actually, the docs are a bit vague about this: drawing_mode said: This only affects the geometric routines like putpixel, lines, rectangles, circles, polygons, floodfill, etc, not the text output, blitting, or sprite drawing functions. but if you go to the blitting and sprites section, only draw_trans_sprite (and draw_lit_sprite) mentions it's affected by the current drawing mode. IIRC blit is not affected by draw_mode, but the docs say the opposite -- |
Gideon Weems
Member #3,925
October 2003
|
Mariusz
Member #1,634
November 2001
|
Well, I had to replace blit with draw_trans_sprite function. Thanks to the fast response from Steve and Oscar. Thank you guys :-) |
Oscar Giner
Member #2,207
April 2002
![]() |
Quote: Eh? Maybe I'm missing something, but the snippet you posted says "not the text output, blitting, or sprite drawing functions".
-- |
Gideon Weems
Member #3,925
October 2003
|
|