示例#1
0
        /// <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);
        }
示例#2
0
 /// <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));
 }
示例#3
0
 /// <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);
 }
示例#4
0
    /// <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;
    }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <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)));
 }
示例#7
0
 /// <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));
 }
示例#8
0
 ///// <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)));
 }
示例#9
0
 /// <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));
 }