/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
ColorModelHSL() {
super("hsl", "Hue", "Saturation", "Lightness", "Transparency"); // NON-NLS: components
}
}
}
}
}
/**
* Converts HSL components of a color to a set of RGB components.
*
* @param hsl a float array with length equal to
* the number of HSL components
* @param rgb a float array with length of at least 3
* that contains RGB components of a color
* @return a float array that contains RGB components
*/
rgb = new float[3];
}
if (saturation > 0.0f) {
float p = 2.0f * lightness - q;
}
else {
}
return rgb;
}
/**
* Converts RGB components of a color to a set of HSL components.
*
* @param rgb a float array with length of at least 3
* that contains RGB components of a color
* @param hsl a float array with length equal to
* the number of HSL components
* @return a float array that contains HSL components
*/
hsl = new float[3];
}
if (saturation > 0.0f) {
? 2.0f - summa
: summa;
}
return hsl;
}
/**
* Returns the smaller of three color components.
*
* @param red the red component of the color
* @param green the green component of the color
* @param blue the blue component of the color
* @return the smaller of {@code red}, {@code green} and {@code blue}
*/
}
/**
* Returns the larger of three color components.
*
* @param red the red component of the color
* @param green the green component of the color
* @param blue the blue component of the color
* @return the larger of {@code red}, {@code green} and {@code blue}
*/
}
/**
* Calculates the hue component for HSL and HSV color spaces.
*
* @param red the red component of the color
* @param green the green component of the color
* @param blue the blue component of the color
* @param max the larger of {@code red}, {@code green} and {@code blue}
* @param min the smaller of {@code red}, {@code green} and {@code blue}
* @return the hue component
*/
if (hue > 0.0f) {
if (hue < 0.0f) {
hue += 6.0f;
}
}
}
else /*max == blue*/ {
}
hue /= 6.0f;
}
return hue;
}
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;
}
}