更改ARGB color int的单通道值

时间:2013-03-17 16:07:07

标签: int bit-manipulation argb

如果我有颜色:

int color = 0x1a2cf3bb; // just an example

我怎样才能改变R通道的值为:

int red = 0xfe; // another example

因此颜色变为:

color = 0x1afef3bb;

1 个答案:

答案 0 :(得分:1)

int result = (color & 0xff00ffff) | red;