问题描述
这是一个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.
的
编辑:请注意,问题的目标不是结束与一个位图,但一个颜色(例如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).
推荐答案
我想你想可能是什么的
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.
这篇关于计算的两种颜色的组合色(过操作者)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!