Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » suggestions for animation with alpha value?

This thread is locked; no one can reply to it. rss feed Print
suggestions for animation with alpha value?
Alex Hanson-White
Member #6,657
December 2005
avatar

Hi,
I'm a bit confused with how to go about blitting a section of a tga file which has alpha values, because the way to blit a transparent image only allows you to draw the whole thing..
Am I overlooking something?
How would I go about blitting a section of a translucent image, and not the whole thing?

Thanks.

count
Member #5,401
January 2005

if it's not possible to blit only a part of the image you could save the animation in different files.

anim_01
anim_02
anim_03

and so on.

Then just blitt the diffrent images.
I do it this way.

Alex Hanson-White
Member #6,657
December 2005
avatar

yeah, i figured that would be possible, but I'm wondering if there is an alternative where you can keep the frames all in 1 file.

Murat AYIK
Member #6,514
October 2005
avatar

You can load one tga file and create individual memory bitmaps using it. Mapping the right alpha values is an easy task.
(edited for clarification)

_____________________________________________________
"The world doesn't care about what storms you sailed through, it is interested in whether you brought the ship to the dock or not!"

ImLeftFooted
Member #3,935
October 2003
avatar

Alex Hanson-White
Member #6,657
December 2005
avatar

gifs can't be translucent like I described, they can only be transparent.
I'm useing the tga format.

Kitty Cat
Member #2,815
October 2002
avatar

Create sub-bitmaps of the main bitmap:
create_sub_bitmap
Don't forget to destroy the sub-bitmaps before the main one.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Alex Hanson-White
Member #6,657
December 2005
avatar

cool, that works great, cat!

tapir
Member #6,629
November 2005

If I rotate the bitmap, will there be a problem about translucency?

Alex Hanson-White
Member #6,657
December 2005
avatar

I wanted to do just that, so I went and tried it, tapir.
rotate_sprite works, it keeps the alphas and evrything.
What you gotta make sure to do is draw/rotate it onto a new bitmap, and then draw the new bitmap instead of the sub_bitmap.

BAF
Member #2,981
December 2002
avatar

What about

? That allows you to draw transparent stuff...

tapir
Member #6,629
November 2005

maksed_blit skips the keycolor, he wants translucency = alpha

Go to: