How to mix two ARGB pixels?

牧云@^-^@ 提交于 2019-11-27 07:41:21
Mark Ransom

Taken from the same Wikipedia article where you got the image:

Translating to values which range from 0 to 255:

rOut = (rA * aA / 255) + (rB * aB * (255 - aA) / (255*255)) gOut = (gA * aA / 255) + (gB * aB * (255 - aA) / (255*255)) bOut = (bA * aA / 255) + (bB * aB * (255 - aA) / (255*255)) aOut = aA + (aB * (255 - aA) / 255) 

It seems like this is what you want: http://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending, but I'm a little confused by your notation since wikipedia says that argb values should range from 0.0 to 1.0. So I don't think this formula will give you FA=19. Can you clarify?

Edit: now that you took out the business about FA=19, I'm inclined to go with that formula.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!