Here you can find the source of normalize(float q, float p, float color)
private static float normalize(float q, float p, float color)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w .ja v a2 s . c o m*/ * Normalizes the red, green and blue values. * @param red The red value. * @param green The green value. * @param blue The blue value. * @return The normalized red, green and blue values. */ public static float[] normalize(int red, int green, int blue) { float[] result = new float[3]; result[0] = normalize(red); result[1] = normalize(green); result[2] = normalize(blue); return result; } /** * This method was copied from class {@code javax.swing.colorchooser.ColorModel} of Java 7. */ private static float normalize(int value) { return (float) (value & 0xFF) / 255.0f; } /** * This method was copied from class {@code javax.swing.colorchooser.ColorModelHSL} of Java 7. */ private static float normalize(float q, float p, float color) { if (color < 1.0f) { return p + (q - p) * color; } if (color < 3.0f) { return q; } if (color < 4.0f) { return p + (q - p) * (4.0f - color); } return p; } }