Remark of BLENDFUNCTION from MSDN
Remarks
When the AlphaFormat member is AC_SRC_ALPHA, the source bitmap must be 32 bpp. If it is not, the AlphaBlend function will fail.
When the BlendOp member is AC_SRC_OVER, the source bitmap is placed over the destination bitmap based on the alpha values of the source pixels.
1.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)) |
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)) |
2.If the source bitmap does not use SourceConstantAlpha (that is, it equals 0xFF), the per-pixel alpha determines the blend of the source and destination bitmaps, as shown in the following table.
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 |
If the destination bitmap has an alpha channel, then the blend is as follows.
Dest.Alpha | = Src.Alpha | + (1 - Src.Alpha) * Dst.Alpha |
3.If the source has both the SourceConstantAlpha (that is, it is not 0xFF) and per-pixel alpha, the source is pre-multiplied by the SourceConstantAlpha and then the blend is based on the per-pixel alpha. The following tables show this. Note that SourceConstantAlpha is divided by 255 because it has a value that ranges from 0 to 255.
Src.Red | = Src.Red | * SourceConstantAlpha / 255.0; |
Src.Green | = Src.Green | * SourceConstantAlpha / 255.0; |
Src.Blue | = Src.Blue | * SourceConstantAlpha / 255.0; |
Src.Alpha | = Src.Alpha | * SourceConstantAlpha / 255.0; |
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 |
Dst.Alpha | = Src.Alpha | + (1 - Src.Alpha) * Dst.Alpha |
===========================分割线===========================
2.
Dst.Red | = Src.Red | + (1 - (Src.Alpha/255.0)) * Dst.Red |
Dst.Green | = Src.Green | + (1 - (Src.Alpha/255.0)) * Dst.Green |
Dst.Blue | = Src.Blue | + (1 - (Src.Alpha/255.0)) * Dst.Blue |
Dest.Alpha | = Src.Alpha | + (1 - (Src.Alpha/255.0)) * Dst.Alpha |
3.
srcAlpha | = Src.Alpha | |
Src.Red | = Src.Red | * SourceConstantAlpha / 255.0; |
Src.Green | = Src.Green | * SourceConstantAlpha / 255.0; |
Src.Blue | = Src.Blue | * SourceConstantAlpha / 255.0; |
Src.Alpha | = Src.Alpha | * SourceConstantAlpha / 255.0; |
Dst.Red | = Src.Red | + (1 - (srcApha/255.0)) * Dst.Red |
Dst.Green | = Src.Green | + (1 - (srcApha/255.0)) * Dst.Green |
Dst.Blue | = Src.Blue | + (1 - (srcApha/255.0)) * Dst.Blue |
Dst.Alpha | = Src.Alpha | + (1 - (srcApha/255.0)) * Dst.Alpha |
MSDN 备注有点错误.应该先除以255.0的
Remark of BLENDFUNCTION from MSDN的更多相关文章
- Visual Studio 2010的MSDN帮助文档离线使用
如果没有在安装vs过程中安装帮助,也可通过Visual Studio帮助菜单中的Manage Help Settings来对帮助进行设置或安装. 可以选择从磁盘安装内容,如果选择从磁盘安装可能会要求提 ...
- MSDN文档篇
很多人网上下载3~10G不等的MSDN文档,发现,下载完成了不会用 很多人每次都得在线下载文档,手上万千PC,都重新下载不是得疯了? so==> 先看几张图 推荐一个工具:https://vsh ...
- 使用SHFB(Sandcastle Help File Builder)建立MSDN风格的代码文档
使用SHFB(Sandcastle Help File Builder)建立MSDN风格的代码文档 下载地址:http://sandcastle.codeplex.com/ 下载地址2:http:// ...
- MSDN杂志上Wix相关的文章
使用 MSBuild 和 Windows Installer XML 执行自动发布: http://msdn.microsoft.com/zh-cn/magazine/cc163456.aspx 用于 ...
- 使用 Async 和 Await 的异步编程(C# 和 Visual Basic)[msdn.microsoft.com]
看到Microsoft官方一篇关于异步编程的文章,感觉挺好,不敢独享,分享给大家. 原文地址:https://msdn.microsoft.com/zh-cn/library/hh191443.asp ...
- [已解决]从微软合作伙伴资源和MSDN下载系统和软件Microsoft download Manager无效
有个itellyou,更新了所有MSDN的软件包.如果自己有微软的注册账户,还是从微软官网下载比较好.而且对自己账户里的系统和itellyou里的做了对比.发现SHA1码不相同,估计官方分配的序列号也 ...
- diff/merge configuration in Team Foundation - common Command and Argument values - MSDN Blogs
One of the extensibility points we have in Team Foundation V1 is that you can configure any other di ...
- 源码网站(msdn.itellyou.cn) good
verysource 100万源码http://www.verysource.com/category/delphi-vcl/ MSDN DOWNLOADhttp://msdn.itellyou.cn ...
- MSDN Library for vs 2010安装及使用(MSDN Library)
VS2010正式版不再有单独的MSDN Library安装选项,VS2010的ISO安装光盘里已经包含有MSDN Library,只不过要手动安装,方法如下: 1.安装完VS2010后,在开始菜单中打 ...
随机推荐
- Android多线程研究(4)——从一道面试题说起
有一道这种面试题:开启一个子线程和主线程同一时候运行,子线程输出10次后接着主线程输出100次,如此重复50次.先看以下代码: package com.maso.test; /** * * @auth ...
- C#如何检测一个字符串是不是合法的URL
C#如何检测一个字符串是不是合法的URL using System.Text.RegularExpressions; /// <summary> /// 检测串值是否 ...
- .net core 1.1.0 MVC 控制器接收Json字串 (JObject对象) (一)
.net core 1.1.0 MVC 控制器接收Json字串 (JObject对象) (二) Json是WEB交互常见的数据,.net core 处理方式是转为强类型,没有对应的强类型会被抛弃,有时 ...
- Qt全局热键(windows篇)
Qt对于系统底层,一直没有很好的支持,例如串口并口通信,还有我们经常都会用到的全局热键,等等.既然Qt可能出于某种原因,不对这些进行支持,我们就只能自己写代码,调用系统相关的API了. 注意,这个 ...
- 关于NSRunLoop和NSTimer的深入理解
一.什么是NSRunLoop NSRunLoop是消息机制的处理模式 NSRunLoop的作用在于有事情做的时候使的当前NSRunLoop的线程工作,没有事情做让当前NSRunLoop的线程休眠 NS ...
- gulp 实践
文档站YDoc 相关注意事项 sass 编译 目录结构 可以直接使用sass编译 ➜ ydoc git:(v2) ✗ sass ./sass/app.scss ./template/source/ap ...
- Leetcode Python Solution(continue update)
leetcode python solution 1. two sum (easy) Given an array of integers, return indices of the two num ...
- centos6.5 apache+tomcat结合 负载均衡
一. 负载均衡:根据 uri 表达式把请求分发给各个服务器处理.如:/*.jsp = lb_s 就是说把所有jsp请求交给lb_s , 当然它是个Tomcat. 二. 安装配置mod_jk m ...
- c#面向对象编程基础
1. 为什么要有面向对象? (1) 增加代码重用. (2)降低维护负担,将具备独特性质的代码封装起来,修改程序时,相互不会影响. 2.数据封装用来解决全局变量不易维护的问题. 3.多态: ...
- CDN调度器HAProxy、Nginx、Varnish
http://www.ttlsa.com/web/the-cdn-scheduler-nginx-haproxy-varnish/ CDN功能如下:1.将全网IP分为若干个IP段组,分组的依据通常是运 ...