Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
Alpha 通道——透明色叠加计算:就是把 rgb 分别加权相加 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


Alpha 透明值:0 完全透明 ~ 255 完全不透明


计算步骤:

  1. 新色值的 rgb 分别乘以 ( alpha / 255 )

  2. 底色的 rgb 分别乘以 ( 1 - (alpha / 255) )

  3. 二者分别相加,组成新的 rgb.


注意事项:

png 图像中,有透明度的像素都已经混合过,存储的透明度信息只是用于混合底色,所以在计算的时候,步骤 1 中的 alpha 要等于 255(步骤 2 中的 alpha 值不变,这样才能混合底色)。

如果要叠加额外透明度(alpha2),则将步骤 1 中的 ( alpha / 255 ) 改为 ( ( alpha * alpha2 ) / ( 255 * 255 ) ),步骤 2 中也减去这么多即可。







返回首页


Copyright (C) 2018-2024 huidong