Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [algif 5] Unnecessary Transparency

This thread is locked; no one can reply to it. rss feed Print
[algif 5] Unnecessary Transparency
Neuton Mouse
Member #15,146
May 2013
avatar

I'm having problems with algif (using a5 5.2.2). For some reason it always tries to render gifs with transparency. I need it to work without transparency.

I played with the source a bit but no results - i just don't get it what it does from the technical point of view.

This is what i should have:
progress21.gif
View Good GIF

This is what i get with allegro:

{"name":"progress30.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd0452b2c437904a094d5ddb6f35722f.gif","w":312,"h":240,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/c\/d\/cd0452b2c437904a094d5ddb6f35722f"}progress30.gif
View Bad GIF

PS: Why is the first gif i've attached to this message resized to itzy-bitzy version?

Elias
Member #358
May 2000

What's your source code?

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

Neuton Mouse
Member #15,146
May 2013
avatar

Not mine but his.

Code is pretty straightforward...

al_clear_to_color(al_map_rgb_f(0, 0, 0));
al_draw_bitmap(algif_get_bitmap(gif,al_get_time()), 16.f, 16.f, 0);
al_flip_display();

I have to note that it actually plays transparent animations good and some with same background color. It feels like it always tries to make transparency out of bitmaps.

Elias
Member #358
May 2000

Do you have the .gif that is not working?

[edit:] nm, figured it out, your first .gif was the actual .gif, and only the second was a video of how it breaks :)

The mistake was quite simple, "disposal method 1" was not implemented. It should be fixed with this commit: https://github.com/allefant/algif5/commit/c363adb52a39c6ef1fc0dc000a076038586c4e9a

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

Neuton Mouse
Member #15,146
May 2013
avatar

Oh, you're the author!

I've checked and... it WORKED! Damn, i was playing with rendering function and thing wasn't there.

Thank you, Elias, for the help and for the addon. You're my hero! :D

Audric
Member #907
January 2001

From reading the patch, I'm surprised the change runs every time, no matter the value of f->disposal_method. Are you sure this doesn't break other GIF cases?

Niunio
Member #1,975
March 2002
avatar

al_clear_to_color(al_map_rgb_f(0, 0, 0));
al_draw_bitmap(algif_get_bitmap(gif,al_get_time()), 16.f, 16.f, 0);
al_flip_display();

I know you fixed it but did you tried to not to clear the screen? Your GIF is using a "combination" mode for animating. I mean, each frame is actually a diff with the previous one.

-----------------
Current projects: Allegro.pas | MinGRo

Elias
Member #358
May 2000

Audric: I agree. I know this used to work (several of the test gifs in the original algif use combination mode: http://algif.sourceforge.net/). And the code is basically identical for this function.

I'll try it with the example gifs of the original tonight.

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

Neuton Mouse
Member #15,146
May 2013
avatar

Niunio said:

I know you fixed it but did you tried to not to clear the screen? Your GIF is using a "combination" mode for animating. I mean, each frame is actually a diff with the previous one.

Diff? Was that it? ???
Oh, now I get how it worked.

It's not just about a single gif that needs to be drawn, there are other objects and visual stuff going on and that stuff relies on screen clear.

GIF feature is required in my game for one particular reason - for tutorial messages. GIF acts as little movie that visually aids explanation. Small and easy to manage. A picture worth thousand words they say.

Niunio
Member #1,975
March 2002
avatar

Quote:

Diff? Was that it? ???

Diff = difference. I think I'm used to the POSIX diff command...::)

-----------------
Current projects: Allegro.pas | MinGRo

Go to: