Question about AplhaBlend

BlitzMax Forums/BlitzMax Programming/Question about AplhaBlend

Curtastic(Posted 2006) [#1]
When I do SetAlpha, why do I have to do SetBlend alphablend for it to work? It seems like a redundant step.

Also setblend is built in, but why isn't alphablend a keyword?

Thanks


FlameDuck(Posted 2006) [#2]
Also setblend is built in, but why isn't alphablend a keyword?
Because it's a constant.


Gabriel(Posted 2006) [#3]
When I do SetAlpha, why do I have to do SetBlend alphablend for it to work? It seems like a redundant step.

Well there are five blend modes. How is BlitzMax going to know which one you want to use unless you tell it? Only one of them can be the default. The other four, you're going to have to tell the compiler what you're doing.


Curtastic(Posted 2006) [#4]
Because it's a constant.

ok flameduck, you'll have to explain more because it seems like it could be both, like Pi.



Well there are five blend modes. How is BlitzMax going to know which one you want to use unless you tell it? Only one of them can be the default. The other four, you're going to have to tell the compiler what you're doing.


Well if alpha<1, blitz could just use its alphablending mode, unless theres some conflict or some situation when the programmer wouldn't want it on alphablend when he set alpha to <1???


Gabriel(Posted 2006) [#5]
Well three of the five blend modes ( ALPHABLEND, LIGHTBLEND AND SHADEBLEND ) can be used with Alpha <1.0 so ok, it narrows the field, but it's still not automatic that if you've set alpha to a non-1 value that you necessarily want ALPHABLEND.


Curtastic(Posted 2006) [#6]
Ok I think I get it, I just haven't used those. So lightblend and shadeblend work on the current alpha value?


ImaginaryHuman(Posted 2006) [#7]
Doesn't SetAlpha specify at which value an alpha pixel is considered to be included or not included? ie the default is 0.5, so any alpha values below 127 will make those pixels hidden, and anything there up will show them?

See, if that's the case, then SetBlend MaskBlend will use it in this way. I think maybe in AlphaBlend you don't have to do SetAlpha at all, as it takes the alpha value from the alpha channel?


Gabriel(Posted 2006) [#8]
See, if that's the case, then SetBlend MaskBlend will use it in this way.

Yeah, I wasn't sure about that, so I left it at 3.

I think maybe in AlphaBlend you don't have to do SetAlpha at all, as it takes the alpha value from the alpha channel?

No, in such a case, the alpha value from the alpha channel is "multiplied" by the alpha you set in SetAlpha. Besides, you don't have to use an image with an alpha channel to use AlphaBlend.