OSDN Git Service

Color, convenience methods.
authorNathanSweet <nathan.sweet@gmail.com>
Sat, 2 Feb 2013 14:20:17 +0000 (15:20 +0100)
committerNathanSweet <nathan.sweet@gmail.com>
Sat, 2 Feb 2013 14:20:17 +0000 (15:20 +0100)
gdx/src/com/badlogic/gdx/graphics/Color.java

index 04ee24b..3aedfe2 100644 (file)
@@ -157,6 +157,30 @@ public class Color {
                this.a = a;\r
        }\r
 \r
+       public void add (float r, float g, float b, float a) {\r
+               this.r += r;\r
+               this.g += g;\r
+               this.b += b;\r
+               this.a += a;\r
+               clamp();\r
+       }\r
+\r
+       public void sub (float r, float g, float b, float a) {\r
+               this.r -= r;\r
+               this.g -= g;\r
+               this.b -= b;\r
+               this.a -= a;\r
+               clamp();\r
+       }\r
+\r
+       public void mul (float r, float g, float b, float a) {\r
+               this.r *= r;\r
+               this.g *= g;\r
+               this.b *= b;\r
+               this.a *= a;\r
+               clamp();\r
+       }\r
+\r
        @Override\r
        public boolean equals (Object o) {\r
                if (this == o) return true;\r