List of usage examples for java.awt Color RGBtoHSB
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals)
From source file:smlm.util.SRutil.java
public static Color getGradientColor(Color ini, Color fin, int numberOfSteps, int step) { if (numberOfSteps == 0) return ini; if (step % numberOfSteps == 0) return ini; if (step % numberOfSteps == numberOfSteps - 1) return fin; else {/*from w w w . j a va2 s .c o m*/ float[] hsbini = Color.RGBtoHSB(ini.getRed(), ini.getGreen(), ini.getBlue(), null); float[] hsbfin = Color.RGBtoHSB(fin.getRed(), fin.getGreen(), fin.getBlue(), null); float h = ((numberOfSteps - step % numberOfSteps) * hsbini[0] + (step % numberOfSteps) * hsbfin[0]) / numberOfSteps; float s = ((numberOfSteps - step % numberOfSteps) * hsbini[1] + (step % numberOfSteps) * hsbfin[1]) / numberOfSteps; float b = ((numberOfSteps - step % numberOfSteps) * hsbini[2] + (step % numberOfSteps) * hsbfin[2]) / numberOfSteps; return Color.getHSBColor(h, s, b); } }
From source file:uk.bl.wa.tika.parser.imagefeatures.FaceDetectionParser.java
private static Color maxBrightness(Color c) { float[] hsv = new float[3]; Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsv); return new Color(Color.HSBtoRGB(hsv[0], hsv[1], 1.0f)); }