AlphaBlend()API函数 [英] AlphaBlend() API Function

查看:314
本文介绍了AlphaBlend()API函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道AlphaBlend()需要预先乘以的alpha位,但我需要一个函数来绘制图像,使其成为常规alpha。我的问题是Alphablend()是作为软件代码实现的,还是使用低级VGA功能来绘制图像?如果它是软件我可以创建
a这样的函数使用常规alpha?

We know AlphaBlend() require pre-multiplied alpha bits, but i need a function to draw image so regular alpha. My question is Alphablend() is implemented as software code or it uses low level VGA features to draw the image? if it is software I can create a such function that uses regular alpha?

谢谢

推荐答案

嗨drjackool,

Hi drjackool,

感谢您在这里发帖。

>>我们知道AlphaBlend()需要预先成倍增加alpha位,但我需要一个函数来绘制图像所以常规alpha。我的问题是Alphablend()是作为软件代码实现的,还是使用低级VGA功能来绘制图像?如果它是软件
我可以创建一个使用常规alpha的函数吗?

根据
MSDN文档
,AlphaBlend函数只需要源和目标混合函数目前仅限于AC_SRC_OVER,这意味着源位图基于源像素的alpha值放置在目标位图上。

According to the MSDN document, the AlphaBlend function only needs the source and destination blend functions are currently limited to AC_SRC_OVER which means source bitmap is placed over the destination bitmap based on the alpha values of the source pixels.

如果源位图没有每像素alpha值(即,未设置AC_SRC_ALPHA),SourceConstantAlpha值确定源位图和目标位图的混合,如下表所示。请注意,SCA在此处用于SourceConstantAlpha
。此外,SCA除以255,因为它的值范围为0到255.

If the source bitmap has no per-pixel alpha value (that is, AC_SRC_ALPHA is not set), the SourceConstantAlpha value determines the blend of the source and destination bitmaps, as shown in the following table. Note that SCA is used for SourceConstantAlpha here. Also, SCA is divided by 255 because it has a value that ranges from 0 to 255.

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)) 

有关计算的更多信息,请请参阅此文档。

For more information about the calculation, please refer to this document.

https://msdn.microsoft.com/en-us/library/dd183393(v = vs.85).aspx?f = 255& mspperror = -2147217396

最诚挚的问候,

Sera Yu


这篇关于AlphaBlend()API函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆