Class InkSet
The inks a printed page uses, fixed when an ink raster is made: the process inks of an output profile, then named spot and technical inks, at most MaxInks in all. Colours naming an ink the set lacks are drawn through their appearance into the process inks, as PDF does for a device without that colorant. Immutable: WithSpot(string, InkAppearance?, ColorantKind) and WithDisabled(string) return a new set.
public sealed class InkSet : IReadOnlyList<Colorant>, IReadOnlyCollection<Colorant>, IEnumerable<Colorant>, IEnumerable
- Inheritance
-
InkSet
- Implements
- Inherited Members
Examples
// The inks of a page: FOGRA39's process inks, a spot colour with how it looks, and a varnish that never shows.
InkSet inks = InkSet.FromProfile(ColorProfile.Fogra39)
.WithSpot("PANTONE 186 C", InkAppearance.Cmyk(0, 1, 0.81f, 0.04f))
.WithSpot("Varnish", null, ColorantKind.Technical);
// Colours as inks: process CMYK, the spot at 60%, and the spot over 30% black (a DeviceN colour).
InkColor text = InkColor.Cmyk(0, 0, 0, 1);
InkColor logo = InkColor.Spot(inks[4], 0.6f);
InkColor shadow = InkColor.Mix(new InkTint(Colorant.Black, 0.3f), new InkTint(inks[4], 1));
InkAppearance? onScreen = shadow.Appearance; // CMYK 0, 1, 0.81, 0.328: the spot's look printed over the black
Fields
MaxInks
The most inks a set holds, process inks included.
public const int MaxInks = 64
Field Value
Properties
Count
Gets the number of inks.
public int Count { get; }
Property Value
this[int]
Gets the ink at index: process inks first, then spots in the order added.
public Colorant this[int index] { get; }
Parameters
indexintThe index.
Property Value
- Colorant
The ink.
ProcessCount
Gets how many of the inks, the first ones, are the profile's process inks.
public int ProcessCount { get; }
Property Value
Profile
Gets the output profile the process inks belong to, which converts RGB, gray and Lab colours into them.
public ColorProfile Profile { get; }
Property Value
Methods
Contains(string)
Returns whether the set has an ink named name.
public bool Contains(string name)
Parameters
namestringThe ink's name.
Returns
FromProfile(ColorProfile)
Returns the set of an output profile's process inks: Cyan, Magenta, Yellow and Black for a CMYK profile; for an n-colour profile the inks its colorant table names, each with its Lab colour at full tint as its appearance (Ink 1, Ink 2 and so on, without appearances, when the table is missing or its names cannot serve, being empty, repeated, All or None).
public static InkSet FromProfile(ColorProfile profile)
Parameters
profileColorProfileThe output profile, such as Fogra39.
Returns
- InkSet
The set.
Exceptions
- ArgumentNullException
profileis null.- ArgumentException
The profile is not a CMYK or n-colour profile: RGB and gray encodings have no inks.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Colorant> GetEnumerator()
Returns
- IEnumerator<Colorant>
An enumerator that can be used to iterate through the collection.
IndexOf(string)
Returns the index of the ink named name (ordinal, case-sensitive), or −1.
public int IndexOf(string name)
Parameters
namestringThe ink's name.
Returns
- int
The index, or −1.
IsDisabled(int)
Returns whether the ink at index is a disabled spot.
public bool IsDisabled(int index)
Parameters
indexintThe index.
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
WithDisabled(string)
Returns this set with a spot disabled: colours naming it are drawn through its appearance into the process inks, as if the set lacked it, and an ink raster keeps no plate for it. MuPDF calls such a separation disabled.
public InkSet WithDisabled(string name)
Parameters
namestringThe spot's name.
Returns
- InkSet
The new set.
Exceptions
- ArgumentException
The set has no spot or technical ink of that name.
WithSpot(Colorant)
Returns this set with a spot or technical ink added after the others.
public InkSet WithSpot(Colorant colorant)
Parameters
colorantColorantThe ink.
Returns
- InkSet
The new set.
Exceptions
- ArgumentNullException
colorantis null.- ArgumentException
The ink is a process ink, the set already has an ink of that name, or it is full.
WithSpot(string, InkAppearance?, ColorantKind)
Returns this set with a spot or technical ink added after the others.
public InkSet WithSpot(string name, InkAppearance? appearance, ColorantKind kind = ColorantKind.Spot)
Parameters
namestringThe ink's name, such as
PANTONE 186 C.appearanceInkAppearance?How a spot looks at full tint, or null; a technical ink never shows.
kindColorantKind
Returns
- InkSet
The new set.
Exceptions
- ArgumentException
The name is not a valid spot name (see Spot(string, InkAppearance?)), the set already has an ink of that name, it is full, or
kindis Process.