Struct PdfColor
A PDF color (spec §8.6).
Can represent device colors (Gray, RGB, CMYK) or colors from custom color spaces.
Assembly: DRIT.Pdf.dll
Syntax
public readonly struct PdfColor : IEquatable<PdfColor>
Fields
Black
Declaration
public static readonly PdfColor Black
Field Value
Blue
Blue color (RGB 0, 0, 1).
Declaration
public static readonly PdfColor Blue
Field Value
Green
Green color (RGB 0, 1, 0).
Declaration
public static readonly PdfColor Green
Field Value
Red
Declaration
public static readonly PdfColor Red
Field Value
White
Declaration
public static readonly PdfColor White
Field Value
Properties
Components
Gets the component values for this color.
Declaration
public ReadOnlySpan<double> Components { get; }
Property Value
Methods
Equals(PdfColor)
Indicates whether this color equals another color.
Declaration
public bool Equals(PdfColor other)
Parameters
Returns
Equals(object?)
Indicates whether this color equals an object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
FromCmyk(double, double, double, double)
CMYK channels each 0.0 to 1.0.
Declaration
public static PdfColor FromCmyk(double c, double m, double y, double k)
Parameters
Returns
FromColorSpace(ColorSpaceFamily, params double[])
Color from a color space and component values.
Declaration
public static PdfColor FromColorSpace(ColorSpaceFamily space, params double[] components)
Parameters
Returns
FromGray(double)
Gray 0.0 (black) to 1.0 (white).
Declaration
public static PdfColor FromGray(double g)
Parameters
| Type |
Name |
Description |
| double |
g |
|
Returns
FromRgb(double, double, double)
RGB channels each 0.0 to 1.0.
Declaration
public static PdfColor FromRgb(double r, double g, double b)
Parameters
Returns
GetHashCode()
Returns a hash code for this color.
Declaration
public override int GetHashCode()
Returns
Overrides
TryGetRgb(out double, out double, out double)
Try to extract approximate RGB values.
Declaration
public bool TryGetRgb(out double r, out double g, out double b)
Parameters
Returns
Operators
operator ==(PdfColor, PdfColor)
Indicates whether two PdfColor instances are equal.
Declaration
public static bool operator ==(PdfColor a, PdfColor b)
Parameters
Returns
operator !=(PdfColor, PdfColor)
Indicates whether two PdfColor instances are not equal.
Declaration
public static bool operator !=(PdfColor a, PdfColor b)
Parameters
Returns
Implements