add Color int-to-float utility

This commit is contained in:
Hannes Janetzek 2013-10-07 01:41:45 +02:00
parent d0dd09a5a4
commit a5c3f92826

View File

@ -103,4 +103,17 @@ public class Color {
| ((int) alpha * ((color >>> 8) & 0xff)) << 8
| ((int) alpha * ((color) & 0xff));
}
public static float rToFloat(int color) {
return ((color >>> 16) & 0xff)/255f;
}
public static float gToFloat(int color) {
return ((color >>> 8) & 0xff)/255f;
}
public static float bToFloat(int color) {
return ((color) & 0xff)/255f;
}
public static float aToFloat(int color) {
return ((color >>> 24) & 0xff)/255f;
}
}