Add methods for extracting red, green and blue color portions from an int color.

This commit is contained in:
Andreas Schildbach 2014-08-15 11:50:49 +02:00
parent a8efe538c1
commit aee3fba9cf
2 changed files with 50 additions and 0 deletions

View file

@ -110,4 +110,19 @@ public class Style implements Serializable
{
return (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
public static int red(final int color)
{
return (color >> 16) & 0xff;
}
public static int green(final int color)
{
return (color >> 8) & 0xff;
}
public static int blue(final int color)
{
return color & 0xff;
}
}