A SERVICE OF

logo

54
Chapter 3: Specifying the Appearance of Geometries
To use the setAlphaFunc() method, you rst set the reference value against which you
measure the alpha value of the pixel to be drawn using setAlphaRef(), for example
setAlphaRef(10);
Then you supply, as an argument to setAlphaFunc(), one of the values of
csContext::AlphaFuncEnum:
NEVER_AFUNC
LESS_AFUNC
EQUAL_AFUNC
LEQUAL_AFUNC
GREATER_AFUNC
NOTEQUAL_AFUNC
GEQUAL_AFUNC
ALWAYS_AFUNC
For example, the following code
setAlphaRef(0.5);
setAlphaFunc(LESS_AFUNC);
is similar to the following lines of code:
if(Alpha < 0.5) {
//draw the pixel };
where Alpha is the alpha values of pixels to be drawn in a geometry.
The values have the following effects:
NEVER_AFUNC
The incoming pixel is never rendered. This function has the effect of
creating a totally transparent geometry.
LESS_AFUNC The incoming pixel is rendered only if its alpha value is less than the
reference value.
ALWAYS_AFUNC
The incoming pixel is always displayed. This function has the effect of
creating an opaque geometry.