Example #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ToneCurve"/> class for a parametric curve.
        /// </summary>
        /// <param name="context">A <see cref="Context"/>, or null for the global context.</param>
        /// <param name="type">The parametric tone curve number.</param>
        /// <param name="parameters">An array of 10 values defining the tone curve parameters for the given <paramref name="type"/>.</param>
        /// <returns>A new <see cref="ToneCurve"/> instance.</returns>
        /// <exception cref="LcmsNETException">
        /// Failed to create instance.
        /// </exception>
        /// <remarks>
        /// Creates the instance in the global context if <paramref name="context"/> is null.
        /// </remarks>
        public static ToneCurve BuildParametric(Context context, int type, double[] parameters)
        {
            if (parameters?.Length > 10)
            {
                throw new ArgumentException($"'{nameof(parameters)}' array size must not exceed 10.");
            }

            return(new ToneCurve(Interop.BuildParametricToneCurve(context?.Handle ?? IntPtr.Zero, type, parameters), context));
        }