Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. // 953274824
  2. int c = 953274824;
  3. Utils.showLog("TENFLOW color parse " + ColorCompat.red(c) +" "+ ColorCompat.green(c) +" "+ ColorCompat.blue(c));
  4. // 200 209 209
  5. Utils.showLog("TENFLOW color to " + ColorCompat.rgb(209, 209, 200));
  6.  
  7. public class ColorCompat
  8. {
  9.     // Color.red()
  10.     public static int red(int color) { return (color >> 16) & 0xFF; }
  11.  
  12.     // Color.green()
  13.     public static int green(int color) { return (color >> 8) & 0xFF; }
  14.  
  15.     // Color.blue()
  16.     public static int blue(int color) { return color & 0xFF; }
  17.  
  18.     // Color.alpha()
  19.     public static int alpha(int color) { return color >>> 24; }
  20.  
  21.     // Color.rgb()
  22.     public static int rgb(int red, int green, int blue)
  23.     {
  24.         return 0xFF000000 | (red << 16) | (green << 8) | blue;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement