/** * Creates a {@link Color} instance from color values usually used by the L*a*b* color space * by scaling them to the 0.0..1.0 range expected by Color's constructor. * @param l the L* component (values between 0 and 100) * @param a the a* component (usually between -128 and +127) * @param b the b* component (usually between -128 and +127) * @param alpha the alpha component (values between 0 and 1) * @return the requested color instance */ public Color toColor(float l, float a, float b, float alpha) { return toColor(new float[] {l, a, b}, alpha); }
/** * Returns a Color object that corresponds to the input Paint's * CIE Lab color value. * * @param e the element using the color * @param c the CIE Lab color definition * @param opacity the opacity * @param ctx the bridge context to use */ public static Color convertCIELabColor(Element e, CIELabColor c, float opacity, BridgeContext ctx) { CIELabColorSpace cs = new CIELabColorSpace(c.getWhitePoint()); float[] lab = c.getColorValues(); Color specColor = cs.toColor(lab[0], lab[1], lab[2], opacity); return specColor; }
/** * Returns a Color object that corresponds to the input Paint's * CIE Lab color value. * * @param e the element using the color * @param c the CIE Lab color definition * @param opacity the opacity * @param ctx the bridge context to use */ public static Color convertCIELabColor(Element e, CIELabColor c, float opacity, BridgeContext ctx) { CIELabColorSpace cs = new CIELabColorSpace(c.getWhitePoint()); float[] lab = c.getColorValues(); Color specColor = cs.toColor(lab[0], lab[1], lab[2], opacity); return specColor; }
/** * Returns a Color object that corresponds to the input Paint's * CIE Lab color value. * * @param e the element using the color * @param c the CIE Lab color definition * @param opacity the opacity * @param ctx the bridge context to use */ public static Color convertCIELabColor(Element e, CIELabColor c, float opacity, BridgeContext ctx) { CIELabColorSpace cs = new CIELabColorSpace(c.getWhitePoint()); float[] lab = c.getColorValues(); Color specColor = cs.toColor(lab[0], lab[1], lab[2], opacity); return specColor; }
result[i] = new NamedColorSpace(name, labCS.toColor(colorvalue, 1.0f), profileName, profileURI); break;
Color labColor = cs.toColor(l, a, b, 1.0f);