计算的两种颜色的组合色(过操作者) [英] Computing the combined color of two colors (Over operator)

查看:257
本文介绍了计算的两种颜色的组合色(过操作者)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个Android应用程序。比方说,我有两个颜色与阿尔法

This is for an Android application. Let's say that I have two colors with alpha

int color1 = 0x12345678  // aarrggbb
int color2 = 0x87654321

我如何计算层颜色2的组合颜色在一层与颜色1?

How do I compute the combined color of a layer with color2 over a layer with color1?

我发现这里的讨论和公式,但检查这里首先如果是在Android和/或Java已经可以写我自己的code之前。

I found here a discussion and formula but checking here first if it is already available in Android and/or Java before writing my own code.

http://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator

编辑:请注意,问题的目标不是结束与一个位图,但一个颜色(例如AARRGGBB INT)

please note that the goal of the question is not to end with a bitmap but a color (e.g. a aarrggbb int).

推荐答案

我想你想可能是什么的 PorterDuff.Mode.Multiply

I think what you want might be PorterDuff.Mode.Multiply

......与 PorterDuffColorFilter

编辑:其实也许你想模式DST_OVER为目标颜色而不是源颜色

Actually maybe you want mode DST_OVER for destination color "over" source color.

这篇关于计算的两种颜色的组合色(过操作者)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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