Advertisement
Guest User

Java2D_Colors

a guest
Nov 11th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. package j2dgame.gfx;
  2.  
  3. public class Colors {
  4. public static int get(int color1, int color2, int color3, int color4) {
  5. return (get(color4) << 24) + (get(color3) << 16) + (get(color2) << 8)
  6. + get(color1);
  7. }
  8.  
  9. private static int get(int color) {
  10. if (color < 0)
  11. return 255;
  12. int r = color / 100 % 10;
  13. int g = color / 10 % 10;
  14. int b = color % 10;
  15. return r * 36 + g * 6 + b;
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement