al_draw_tinted_bitmap_region and transparency
23yrold3yrold

Does al_draw_tinted_bitmap_region ignore the alpha value in ALLEGRO_COLOR?

    // draws the bitmap normally
    al_draw_tinted_bitmap_region(image, al_map_rgba(255, 255, 255, 255), 0, 0, 40, 40, 0, 0, 0);

    // draws the bitmap normally (same as above)
    al_draw_tinted_bitmap_region(image, al_map_rgba(255, 255, 255, 0), 0, 0, 40, 40, 0, 0, 0);

    // draws the bitmap tinted purple
    al_draw_tinted_bitmap_region(image, al_map_rgba(255, 0, 255, 0), 0, 0, 40, 40, 0, 0, 0);

The code documentation implies that the alpha should affect al_draw_tinted_bitmap_region() like it affects al_draw_tinted_bitmap() ... if it doesn't that's inconvenient. :)

Matthew Leverton

Which blender are you using? It's pre-multiplied by default:

al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA)

which means you have to call: al_map_rgb(r*a,g*a,b*a,a).

Edit: Oh, this is the tinted functions. Not sure how those work, or if any of the above applies.

23yrold3yrold

I have yet to explicitly use a blender. Passing an ALLEGRO_COLOR has pretty much been doing it for me ...

Matthew Leverton

Looks like I'm right. See thread discussions on the al_draw_tinted_bitmap() page.

23yrold3yrold

Hmmm. That's a little odd IMHO, but ... okay! It does work ...

Matthew Leverton

It's okay. I'll be answering this same question for the rest of my life. :-/

Elias

In return you'll never have to answer questions about why sprites get mysterious dark outlines :)

Thread #606402. Printed from Allegro.cc