Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1.  
  2. public class Color extends FourBytes{
  3.  
  4. public Color(int argb) {
  5. super(argb);
  6. }
  7.  
  8. public Color(int alpha, int red, int green, int blue) {
  9. super(blue);
  10. setAlpha(alpha);
  11. setRed(red);
  12. setGreen(green);
  13. }
  14. public Color(Color other) {
  15. this(other.getARGB());
  16. }
  17.  
  18. public int getARGB() {
  19. return this.getInt();
  20. }
  21. public int getAlpha() {
  22. return getBits(8,24);
  23. }
  24. public int getRed() {
  25. return getBits(8,16);
  26. }
  27. public int getGreen() {
  28. return getBits(8,8);
  29. }
  30. public int getBlue() {
  31. return getBits(8,0);
  32. }
  33. public void setARGB(int argb) {
  34. this.setInt(argb);
  35. }
  36. public void setAlpha(int alpha) {
  37. this.setBits(8, 24, alpha);
  38. }
  39. public void setRed(int red) {
  40. this.setBits(8, 16, red);
  41. }
  42.  
  43. public void setGreen(int green) {
  44. this.setBits(8, 8, green);
  45. }
  46. public void setBlue(int blue) {
  47. this.setBits(8, 0, blue);
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement