Example #1
0
 /// <summary>
 /// Creates a new instance of the <see cref="Transform"/> class for a multiprofile transform
 /// exposing all parameters for each profile in the chain.
 /// </summary>
 /// <param name="context">A <see cref="Context"/>, or null for the global context.</param>
 /// <param name="profiles">An array of profiles.</param>
 /// <param name="bpc">An array of black point compensation states.</param>
 /// <param name="intents">An array of intents.</param>
 /// <param name="adaptationStates">An array of adaptation states.</param>
 /// <param name="gamut">A profile holding gamut information for a gamut check, can be null.</param>
 /// <param name="gamutPCSPosition">Position in the chain of Lab/XYZ PCS to check gamut.</param>
 /// <param name="inputFormat">The input format, e.g., <see cref="Cms.TYPE_RGB_8"/>.</param>
 /// <param name="outputFormat">The output format, e.g. <see cref="Cms.TYPE_XYZ_16"/>.</param>
 /// <param name="flags">The flags to control the process.</param>
 /// <returns>A new <see cref="Transform"/> instance.</returns>
 /// <exception cref="LcmsNETException">
 /// Failed to create instance.
 /// </exception>
 /// <remarks>
 /// <para>
 /// <paramref name="gamut"/> and <paramref name="gamutPCSPosition"/> are only used if
 /// <paramref name="flags"/> includes <see cref="CmsFlags.GamutCheck"/>.
 /// </para>
 /// <para>
 /// Creates the instance in the global context if <paramref name="context"/> is null.
 /// </para>
 /// </remarks>
 public static Transform Create(Context context, Profile[] profiles, bool[] bpc, Intent[] intents,
                                double[] adaptationStates, Profile gamut, int gamutPCSPosition, uint inputFormat, uint outputFormat, CmsFlags flags)
 {
     return(new Transform(Interop.CreateExtendedTransform(context?.Handle ?? IntPtr.Zero,
                                                          profiles.Select(_ => _.Handle).ToArray(),
                                                          bpc.Select(_ => _ ? 1 : 0).ToArray(),
                                                          intents.Select(_ => Convert.ToUInt32(_)).ToArray(), adaptationStates, gamut?.Handle ?? IntPtr.Zero,
                                                          gamutPCSPosition, inputFormat, outputFormat, Convert.ToUInt32(flags)), context));
 }