你是否正在寻找关于alphablend的内容?让我把最完整的东西奉献给你:
alphablend是Window自带的GDI函数,在作GUI的时候为了达到更漂亮的效果我们常常用它.
BLENDFUNCTION是alphablend用控制透明效果的重要参数.
定义如下:
typedef struct _BLENDFUNCTION { BYTE BlendOp; BYTE BlendFlags; BYTE SourceConstantAlpha; BYTE AlphaFormat; }BLENDFUNCTION, *PBLENDFUNCTION, *LPBLENDFUNCTION;
BlendOp: 这个参数必须也只能为AC_SRC_OVER(0x00),意思就是把源图片覆盖到目标之上.
BlendFlags: 必须为0
SourceConstantAlpha: 简写为SCA,指定源图片的透明度,这个是会和源图片的Alpha通道合并计算的.
AlphaFormat: 可以填两种,一种是0x00,一种是AC_SRC_ALPHA(0x01).填0的话,AlphaBlend据说就和BitBlt一样了,我没有试验过~填1的话,源DC必须是32位的DC不然的话,alphablend会返回参数错误.
计算公式(当SCA不是0xFF时):
输出像素(R,G,B,A) = 源像素(R,G,B,A) * SCA / 0xFF 目标像素(R,G,B,A) * (1.0 - SCA / 0xFF)
当SCA是0xFF时,计算公式
输出像素(R,G,B,A) = 源像素(R,G,B,A) 目标像素(R,G,B,A) * (1.0 - 源像素(A) / 0xFF)
混合计算公式
输出像素(R,G,B) = 源像素(R,G,B) * SCA / 0xFF 目标像素(R,G,B) * (1.0 - 源像素(A) / 0xFF * SCA / 0xFF)
全部是PBGRA预乘方式:
Value Meaning
AC_SRC_ALPHA This flag is set when the bitmap has an Alpha channel (that is, per-pixel alpha). Note that the APIs use premultiplied alpha, which means that the red, green and blue channel values in the bitmap must be premultiplied with the alpha channel value. For example, if the alpha channel value is x, the red, green and blue channels must be multiplied by x and divided by 0xff prior to the call.
以上就是关于alphablend的全部内容,相信你一定会非常满意,。
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/shenmilingyu/article-5747-1.html
但是他也推进了
1依然没有躲过淘汰的命运
都适合和你白头到老有的人