Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » tint a bitmap

This thread is locked; no one can reply to it. rss feed Print
tint a bitmap
jamal
Member #3,326
March 2003
avatar

hi all,

i'd like to tint a bitmap with a color, so i tried draw_lit_sprite. the function seems to do what i want, but it doesn't seem to skip the transparent color. it there a way to make draw_lit_sprite skip the transparent color ?

gnolam
Member #2,030
March 2002
avatar

It does mask out transparent pixels. Show us your code, and attach a sprite that displays incorrectly.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

jamal
Member #3,326
March 2003
avatar

i attached a screenshot of the problem :
the sprite at the bottom is the original sprite, drawn with draw_sprite, and the sprite at the top is drawn with draw_lit_sprite. here's the code :

set_add_blender(getr(color),getg(color),getb(color),128);
draw_lit_sprite(bmp, asteroid, (int)b->getX(), (int)b->getY(), 128);

btw i work in 16bpp mode.

X-G
Member #856
December 2000
avatar

What does the sprite itself look like? Attach that, too.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

jamal
Member #3,326
March 2003
avatar

i was attaching the sprite when i noticed that the background color is ... black :-/
i was sure that all my sprites background is magic pink, i tested whith the only one that is not. anyway, thanks for your help :) !

Dustin Dettmer
Member #3,935
October 2003
avatar

Bitmap *b;
Tint t;

t.a = 0.5f;

b->blitToScreen(x, y, t);

gnolam
Member #2,030
March 2002
avatar

Can we please get Dustin a custom title of "Allegro.cc Official Troll"?

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Dustin Dettmer
Member #3,935
October 2003
avatar

I was actually trying to get a plug for the Thing library, which would solve many of the OP's problems.

What I didn't bother explaining is that if you're trying to tint crap, you really shouldn't be using Allegro anymore.

Go to: