JAL-3130 adapted getdown src. attempt 2. first attempt failed due to cp'ed .git files
[jalview.git] / getdown / src / getdown / core / src / main / java / com / threerings / getdown / util / Color.java
1 //
2 // Getdown - application installer, patcher and launcher
3 // Copyright (C) 2004-2018 Getdown authors
4 // https://github.com/threerings/getdown/blob/master/LICENSE
5
6 package com.threerings.getdown.util;
7
8 /**
9  * Utilities for handling ARGB colors.
10  */
11 public class Color
12 {
13     public final static int CLEAR = 0x00000000;
14     public final static int WHITE = 0xFFFFFFFF;
15     public final static int BLACK = 0xFF000000;
16
17     public static float brightness (int argb) {
18         // TODO: we're ignoring alpha here...
19         int red = (argb >> 16) & 0xFF;
20         int green = (argb >> 8) & 0xFF;
21         int blue = (argb >> 0) & 0xFF;
22         int max = Math.max(Math.max(red, green), blue);
23         return ((float) max) / 255.0f;
24     }
25
26     private Color () {}
27 }