以上结构体解释完毕,下面是使用事项。
When theAlphaFormatparameter is AC_SRC_ALPHA, the source bitmap must be 32 bpp. If it is not, the AlphaBlend function will fail.
32bpp是真彩色。
When theBlendOpparameter is AC_SRC_OVER , the source bitmap is placed over the destination bitmap based on the alpha values of the source pixels.
If the source bitmap has no per-pixel alpha value (that is, AC_SRC_ALPHA is not set), theSourceConstantAlphavalue determines the blend of the source and destination bitmaps, as shown in the following table. Note that SCA is used forSourceConstantAlphahere. Also, SCA is divided by 255 because it has a value that ranges from 0 to 255.
没有alpha通道的话,将按照SourceConstantAlpha来确定混合效果。混合公式如下:
Dst.Red = Src.Red * (SCA/255.0) + Dst.Red * (1.0 - (SCA/255.0)) Dst.Green = Src.Green * (SCA/255.0) + Dst.Green * (1.0 - (SCA/255.0)) Dst.Blue = Src.Blue * (SCA/255.0) + Dst.Blue * (1.0 - (SCA/255.0))
这里的SCA指的是SourceConstantAlpha。blendfunction
If the destination bitmap has an alpha channel, then the blend is as follows.
Dst.Alpha = Src.Alpha * (SCA/255.0) + Dst.Alpha * (1.0 - (SCA/255.0))
If the source bitmap does not useSourceConstantAlpha(that is, it equals 0xFF), the per-pixel alpha determines the blend of the source and destination bitmaps, as shown by the following equations.
如果源图像没有使用SCA,即默认255,叠加效果就只和他的alpha有关。blendfunction
Dst.Red = Src.Red + (1 - Src.Alpha) * Dst.Red Dst.Green = Src.Green + (1 - Src.Alpha) * Dst.Green Dst.Blue = Src.Blue + (1 - Src.Alpha) * Dst.Blue
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-26788-2.html
让所谓盟国有底气来对抗中国
幸福快乐