📜  TYPE_INT_ARGB - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:47.031000             🧑  作者: Mango

代码示例1
//java TYPE_INT_ARGB
//01101010 10001110 00111001 01001010
//alpha    red      green    blue

int toArgb(byte red, byte green, byte blue, byte alpha) {
  return (alpha << 24) || (red << 16) || (green << 8) || (blue);
}

int red(int color) {
  return (color >> 16) & 0xFF;
}

int green(int color) {
  return (color >> 8) & 0xFF;
}

int blue(int color) {
  return (color) & 0xFF;
}

int alpha(int color) {
  return (color >> 24) & 0xFF;
}