APPLYING TO TRANSPARENCIAS IMAGES

Blitz3D Forums/Blitz3D Programming/APPLYING TO TRANSPARENCIAS IMAGES

demuvi(Posted 2008) [#1]
Hi I have a small problem when loading an image on the screen that need to fade away as time passes until it disappears completely Why do that?.


Ross C(Posted 2008) [#2]
Hmmm, i assume you want to fade an image, and your asking how to do that?

Well, first off, is it an image, OR, a sprite? Basically 2d or 3d?

First off, 2d in blitz doesn't support real time alpha. Does the image move when it's fading, or does the backround change when it's fading. If the answer is no to that, then you can manually alter the pixel colour, to fake a fade operation alot quicker. Even better, create an animated image.


markcw(Posted 2008) [#3]
Well, like Ross says images don't have alpha, only 3d textures have alpha. Images ignore the alpha byte, they only have a mask color and any pixel of that color value will be transparent/invisible.

If it's a simple fade to background color then you want to code a function to fade an image. Something like this:
FadeImage(sourceimage,targetimage,fade,time)
Then you could just call that in your main loop until it's done.

If you don't need the image after the fade then you could do something like this:
FadeImage(image,fade,time)
The first is better because you can fade/unfade an image and you also don't loose the image after the fade.

You need to know about Read/WritePixelFast, etc. and know how to separate the 32-bit color into bytes using And, etc. so you can then reduce each component by the fade amount and then add them back together.