/// <summary> /// Create the nearest LAB equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The LAB equivalent of the XYZ color.</returns> public static ColorLAB CreateFromXYZ(ColorXYZ xyz) { double l, a, b; ColorConverter.XYZ_To_CIELAB(xyz.m_x, xyz.m_y, xyz.m_z, out l, out a, out b); ColorLAB lab = new ColorLAB(l, a, b) { m_alpha = xyz.m_a }; return(lab); }
/// <summary> /// Create the nearest LCH equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The LCH equivalent of the XYZ color.</returns> public static ColorLCH CreateFromXYZ(ColorXYZ xyz) { return CreateFromLAB(ColorLAB.CreateFromXYZ(xyz)); }
/// <summary> /// Create the nearest HSL equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The HSL equivalent of the XYZ color.</returns> public static ColorHSL CreateFromXYZ(ColorXYZ xyz) { return new ColorHSL(xyz); }
/// <summary> /// Create the nearest LAB equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The LAB equivalent of the XYZ color.</returns> public static ColorLAB CreateFromXYZ(ColorXYZ xyz) { double l, a, b; ColorConverter.XYZ_To_CIELAB(xyz.m_x, xyz.m_y, xyz.m_z, out l, out a, out b); ColorLAB lab = new ColorLAB(l, a, b) {m_alpha = xyz.m_a}; return lab; }
/// <summary> /// Constructs the nearest CMYK equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The CMYK equivalent of the XYZ color.</returns> public static ColorCMYK CreateFromXYZ(ColorXYZ xyz) { return new ColorCMYK(xyz); }
/// <summary> /// Create the nearest LCH equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The LCH equivalent of the XYZ color.</returns> public static ColorLCH CreateFromXYZ(ColorXYZ xyz) { return(CreateFromLAB(ColorLAB.CreateFromXYZ(xyz))); }
/// <summary> /// Create the nearest HSL equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The HSL equivalent of the XYZ color.</returns> public static ColorHSL CreateFromXYZ(ColorXYZ xyz) { return(new ColorHSL(xyz)); }
///// <summary> ///// Create the nearest LAB equivalent of an RGB color. ///// </summary> ///// <param name="rgb">Target color in RGB space.</param> ///// <returns>The LAB equivalent of the RGB color.</returns> //public static ColorLAB CreateFromRGB(ColorRGB rgb) //{ // return CreateFromXYZ(ColorXYZ.CreateFromRGB(rgb)); //} /// <summary> /// Create the nearest LAB equivalent of an HSL color. /// </summary> /// <param name="hsl">Target color in HSL space.</param> /// <returns>The LAB equivalent of the HSL color.</returns> public static ColorLAB CreateFromHSL(ColorHSL hsl) { return(CreateFromXYZ(ColorXYZ.CreateFromHSL(hsl))); }
/// <summary> /// Constructs the nearest CMYK equivalent of an XYZ color. /// </summary> /// <param name="xyz">Target color in XYZ space.</param> /// <returns>The CMYK equivalent of the XYZ color.</returns> public static ColorCMYK CreateFromXYZ(ColorXYZ xyz) { return(new ColorCMYK(xyz)); }