Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » al_draw_tinted_bitmap_region and transparency

Credits go to Matthew Leverton for helping out!
This thread is locked; no one can reply to it. rss feed Print
al_draw_tinted_bitmap_region and transparency
23yrold3yrold
Member #1,134
March 2001
avatar

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

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Matthew Leverton
Supreme Loser
January 1999
avatar

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
Member #1,134
March 2001
avatar

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

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Matthew Leverton
Supreme Loser
January 1999
avatar

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

23yrold3yrold
Member #1,134
March 2001
avatar

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

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Matthew Leverton
Supreme Loser
January 1999
avatar

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

Elias
Member #358
May 2000

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

--
"Either help out or stop whining" - Evert

Go to: