tint a bitmap
jamal

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

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

jamal

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

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

jamal

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 :) !

ImLeftFooted
Bitmap *b;
Tint t;

t.a = 0.5f;

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

gnolam

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

ImLeftFooted

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.

Thread #590119. Printed from Allegro.cc