Пример #1
0
        /// <summary>
        /// Create the nearest XYZ equivalent of a Lab color.
        /// </summary>
        /// <param name="lab">Target color in LAB space.</param>
        /// <returns>The XYZ equivalent of the LAB color.</returns>
        public static ColorXYZ CreateFromLAB(ColorLAB lab)
        {
            double x, y, z;

            ColorConverter.CIELAB_To_XYZ(lab.m_l, lab.m_a, lab.m_b, out x, out y, out z);
            return(new ColorXYZ(lab.A, x, y, z));
        }
Пример #2
0
        /// <summary>
        /// Create the nearest LCH equivalent of a LAB color.
        /// </summary>
        /// <param name="lab">Target color in LAB space.</param>
        /// <returns>The LCH equivalent of the LAB color.</returns>
        public static ColorLCH CreateFromLAB(ColorLAB lab)
        {
            double l, c, h;

            ColorConverter.CIELAB_To_CIELCH(lab.m_l, lab.m_a, lab.m_b, out l, out c, out h);

            ColorLCH lch = new ColorLCH(l, c, h)
            {
                m_a = lab.m_alpha
            };

            return(lch);
        }
Пример #3
0
        /// <summary>
        /// Create the nearest LAB equivalent of an LCH color.
        /// </summary>
        /// <param name="lch">Target color in LCH space.</param>
        /// <returns>The LAB equivalent of the LCH color.</returns>
        public static ColorLAB CreateFromLCH(ColorLCH lch)
        {
            double l, a, b;

            ColorConverter.CIELCH_To_CIELAB(lch.m_l, lch.m_c, lch.m_h, out l, out a, out b);

            ColorLAB lab = new ColorLAB(l, a, b)
            {
                m_alpha = lch.m_a
            };

            return(lab);
        }
Пример #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>
    /// Create the nearest LCH equivalent of a LAB color.
    /// </summary>
    /// <param name="lab">Target color in LAB space.</param>
    /// <returns>The LCH equivalent of the LAB color.</returns>
    public static ColorLCH CreateFromLAB(ColorLAB lab)
    {
      double l, c, h;
      ColorConverter.CIELAB_To_CIELCH(lab.m_l, lab.m_a, lab.m_b, out l, out c, out h);

      ColorLCH lch = new ColorLCH(l, c, h) {m_a = lab.m_alpha};
      return lch;
    }
Пример #6
0
 /// <summary>
 /// Create the nearest HSL equivalent of a LAB color.
 /// </summary>
 /// <param name="lab">Target color in LAB space.</param>
 /// <returns>The HSL equivalent of the LAB color.</returns>
 public static ColorHSL CreateFromLAB(ColorLAB lab)
 {
   return new ColorHSL(lab);
 }
Пример #7
0
    /// <summary>
    /// Create the nearest LAB equivalent of an LCH color.
    /// </summary>
    /// <param name="lch">Target color in LCH space.</param>
    /// <returns>The LAB equivalent of the LCH color.</returns>
    public static ColorLAB CreateFromLCH(ColorLCH lch)
    {
      double l, a, b;
      ColorConverter.CIELCH_To_CIELAB(lch.m_l , lch.m_c , lch.m_h, out l, out a, out b);

      ColorLAB lab = new ColorLAB(l, a, b) {m_alpha = lch.m_a};
      return lab;
    }
Пример #8
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;
    }
Пример #9
0
 /// <summary>
 /// Create the nearest XYZ equivalent of a Lab color.
 /// </summary>
 /// <param name="lab">Target color in LAB space.</param>
 /// <returns>The XYZ equivalent of the LAB color.</returns>
 public static ColorXYZ CreateFromLAB(ColorLAB lab)
 {
   double x, y, z;
   ColorConverter.CIELAB_To_XYZ(lab.m_l, lab.m_a, lab.m_b, out x, out y, out z);
   return new ColorXYZ(lab.A, x, y, z);
 }
Пример #10
0
 /// <summary>
 /// Constructs the nearest CMYK equivalent of a LAB color.
 /// </summary>
 /// <param name="lab">Target color in LAB space.</param>
 /// <returns>The CMYK equivalent of the LAB color.</returns>
 public static ColorCMYK CreateFromLAB(ColorLAB lab)
 {
   return new ColorCMYK(lab);
 }
Пример #11
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)));
 }
Пример #12
0
 /// <summary>
 /// Create the nearest LCH equivalent of an HSL color.
 /// </summary>
 /// <param name="hsl">Target color in HSL space.</param>
 /// <returns>The LCH equivalent of the HSL color.</returns>
 public static ColorLCH CreateFromHSL(ColorHSL hsl)
 {
     return(CreateFromLAB(ColorLAB.CreateFromHSL(hsl)));
 }
Пример #13
0
 /// <summary>
 /// Create the nearest HSL equivalent of a LAB color.
 /// </summary>
 /// <param name="lab">Target color in LAB space.</param>
 /// <returns>The HSL equivalent of the LAB color.</returns>
 public static ColorHSL CreateFromLAB(ColorLAB lab)
 {
     return(new ColorHSL(lab));
 }
Пример #14
0
 /// <summary>
 /// Create the nearest XYZ equivalent of an LCH color.
 /// </summary>
 /// <param name="lch">Target color in LCH space.</param>
 /// <returns>The XYZ equivalent of the LCH color.</returns>
 public static ColorXYZ CreateFromLCH(ColorLCH lch)
 {
     return(CreateFromLAB(ColorLAB.CreateFromLCH(lch)));
 }
Пример #15
0
 /// <summary>
 /// Constructs the nearest CMYK equivalent of a LAB color.
 /// </summary>
 /// <param name="lab">Target color in LAB space.</param>
 /// <returns>The CMYK equivalent of the LAB color.</returns>
 public static ColorCMYK CreateFromLAB(ColorLAB lab)
 {
     return(new ColorCMYK(lab));
 }