user485498
user485498

Reputation:

Change ARGB color int's single channel value

If I have a color:

int color = 0x1a2cf3bb; // just an example

How can I change, for examle, just the R channel with the value:

int red = 0xfe; // another example

So that color becomes:

color = 0x1afef3bb;

Upvotes: 0

Views: 247

Answers (1)

Adam Stelmaszczyk
Adam Stelmaszczyk

Reputation: 19837

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

Upvotes: 1

Related Questions