Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**Checks each color of an int[7], one by one for full transparency;
- *
- * if the color is opaque, it returns it,
- * if the color is fully transparent, the next color is checked,
- * if all colors are fully transparent, it returns a set default color.**/
- public static int getPaletteColor(int[] pColors) {
- int pColorFinal;
- if (tCheck(pColors[0])) pColorFinal = pColors[0];
- else if (tCheck(pColors[1])) pColorFinal = pColors[1];
- else if (tCheck(pColors[2])) pColorFinal = pColors[2];
- else if (tCheck(pColors[3])) pColorFinal = pColors[3];
- else if (tCheck(pColors[4])) pColorFinal = pColors[4];
- else if (tCheck(pColors[5])) pColorFinal = pColors[5];
- else pColorFinal = pColors[6];
- return pColorFinal;}
- /**Boolean that uses the default luminance double to check for transparency/opaqueness**/
- private static boolean tCheck(int c) {
- return ColorUtils.calculateLuminance(c) > 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement