alpha on imagebuffer

Blitz3D Forums/Blitz3D Programming/alpha on imagebuffer

LAB[au](Posted 2005) [#1]
I am trying to write some pixels on an imagebuffer, but i would like to "write" transparent pixels. I can't seem to reproduce the effect, but it worked several times, and I don't remenber how to do it ...
It was working with:

setbuffer imagebuffer(myimage)
color r,g,b
plot x,y
setbuffer backbuffer()

is there a "special value to set r,g,b to, to have transparent pixels?


jfk EO-11110(Posted 2005) [#2]
You mean fully transparent pixels? Per default all black Pixels are transparent when you use DrawImage. When you use DrawBlock, all Pixels will be drawn, also the black ones.

You can alter the Default Mask Color from black to anything you like by using the imageMask Command (see docs).

It is not possible to make images semitransparent like textures (true alpha, eg. EntityAlpha mesh,0.5).

Instead you need to use pixelperfect pseudo-images that are made of textured Quads. There are various examples, also in the code archives:
http://homepage.ntlworld.com/config/spritecontrol/spritecontrol.htm
http://www.blitzbasic.com/codearcs/codearcs.php?code=773
http://www.blitzbasic.com/codearcs/codearcs.php?code=1173


Also, if you have multiple halftransparent quads or sprites, that are overlapping then you need to do some things to pervent Z-Order fickering. Have a look at Beaker's Z-Order Code:
http://www.blitzbasic.com/codearcs/codearcs.php?code=850