Convert RGB to ARGB
1
2
3
4
5
6
|
public
int
convert_RGB_to_ARGB(
int
rgb) {
int
r = (rgb >>
16
) &
0xFF
;
int
g = (rgb >>
8
) &
0xFF
;
int
b = (rgb >>
0
) &
0xFF
;
return
0xff000000
| (r <<
16
) | (g <<
8
) | b;
}
|
Convert ARGB to RGB
1
2
3
4
5
6
7
|
public
int
convert_ARGB_to_RGB(
int
argb) {
int
a = (argb >>
24
) &
0xFF
;
int
r = (argb >>
16
) &
0xFF
;
int
g = (argb >>
8
) &
0xFF
;
int
b = (argb >>
0
) &
0xFF
;
return
(r <<
16
) | (g <<
8
) | b;
}
|