Struct Ink
- Namespace
- Rustaveli.Pdf
- Assembly
- Rustaveli.Pdf.dll
A colour as print thinks of it: an RGB colour, a CMYK process colour, or a named spot ink with a process-colour fallback — at some tint and opacity (docs/adr/0004-ink-colour-model.md).
public readonly struct Ink : IEquatable<Ink>
- Implements
- Inherited Members
Remarks
Components are fractions from 0 to 1. A tint is a percentage of an ink, as a press lays down less of it: a tint of an RGB colour moves it toward white paper, a tint of a process colour scales each component, and a tint of a spot ink is recorded as the tint the plate prints at. Opacity is separate, and describes how much of what lies beneath shows through.
Properties
Black
Black ink alone: what black text and rules should print with.
public static Ink Black { get; }
Property Value
FallbackModel
For a spot ink, the model its fallback is specified in; otherwise the ink's own model.
public InkModel FallbackModel { get; }
Property Value
IsTransparent
public bool IsTransparent { get; }
Property Value
Model
public InkModel Model { get; }
Property Value
Opacity
From 0, invisible, to 1, fully covering what lies beneath.
public float Opacity { get; }
Property Value
Registration
Prints on every separation, for crop and registration marks.
public static Ink Registration { get; }
Property Value
SpotName
The spot ink's name, or null for a process colour.
public string? SpotName { get; }
Property Value
SpotTint
For a spot ink, the tint its plate prints at, from 0 to 1; otherwise 1.
public float SpotTint { get; }
Property Value
Transparent
Nothing is drawn.
public static Ink Transparent { get; }
Property Value
White
No ink at all: the paper shows.
public static Ink White { get; }
Property Value
Methods
Cmyk(float, float, float, float)
public static Ink Cmyk(float cyan, float magenta, float yellow, float black)
Parameters
Returns
Equals(Ink)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Ink other)
Parameters
otherInkAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Hex(string)
Parses #RGB, #ARGB, #RRGGBB or #AARRGGBB as an RGB ink. The leading hash is optional;
an alpha channel becomes the ink's opacity.
public static Ink Hex(string hex)
Parameters
hexstring
Returns
Rgb(byte, byte, byte)
public static Ink Rgb(byte red, byte green, byte blue)
Parameters
Returns
Spot(string, Ink)
A named spot ink. The fallback is what devices that cannot print the spot ink use instead.
public static Ink Spot(string name, Ink fallback)
Parameters
Returns
Tint(float)
A percentage of this ink, from 0 (none: bare paper) to 1 (the ink itself).
public Ink Tint(float amount)
Parameters
amountfloat
Returns
ToCmyk()
The colour as cyan, magenta, yellow and black fractions. RGB converts without a colour profile, with black generated from the darkest channel; a spot ink gives its fallback at the spot ink's tint.
public (float Cyan, float Magenta, float Yellow, float Black) ToCmyk()
Returns
ToRgb()
The colour as red, green and blue fractions, for output that can only show RGB. Process colours convert without a colour profile; a spot ink shows its fallback at the spot ink's tint.
public (float Red, float Green, float Blue) ToRgb()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
WithOpacity(float)
public Ink WithOpacity(float opacity)
Parameters
opacityfloat
Returns
Operators
operator ==(Ink, Ink)
public static bool operator ==(Ink left, Ink right)
Parameters
Returns
operator !=(Ink, Ink)
public static bool operator !=(Ink left, Ink right)