• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Struct PdfColor

A PDF color (spec §8.6). Can represent device colors (Gray, RGB, CMYK) or colors from custom color spaces.

Implements
IEquatable<PdfColor>
Inherited Members
ValueType.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: DRIT.Pdf.Content
Assembly: DRIT.Pdf.dll
Syntax
public readonly struct PdfColor : IEquatable<PdfColor>

Fields

Black

Black color (gray 0.0).

Declaration
public static readonly PdfColor Black
Field Value
Type Description
PdfColor

Blue

Blue color (RGB 0, 0, 1).

Declaration
public static readonly PdfColor Blue
Field Value
Type Description
PdfColor

Green

Green color (RGB 0, 1, 0).

Declaration
public static readonly PdfColor Green
Field Value
Type Description
PdfColor

Red

Red color (RGB 1, 0, 0).

Declaration
public static readonly PdfColor Red
Field Value
Type Description
PdfColor

White

White color (gray 1.0).

Declaration
public static readonly PdfColor White
Field Value
Type Description
PdfColor

Properties

Components

Gets the component values for this color.

Declaration
public ReadOnlySpan<double> Components { get; }
Property Value
Type Description
ReadOnlySpan<double>

Methods

Equals(PdfColor)

Indicates whether this color equals another color.

Declaration
public bool Equals(PdfColor other)
Parameters
Type Name Description
PdfColor other
Returns
Type Description
bool

Equals(object?)

Indicates whether this color equals an object.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)

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
Type Name Description
double c
double m
double y
double k
Returns
Type Description
PdfColor

FromColorSpace(ColorSpaceFamily, params double[])

Color from a color space and component values.

Declaration
public static PdfColor FromColorSpace(ColorSpaceFamily space, params double[] components)
Parameters
Type Name Description
ColorSpaceFamily space
double[] components
Returns
Type Description
PdfColor

FromGray(double)

Gray 0.0 (black) to 1.0 (white).

Declaration
public static PdfColor FromGray(double g)
Parameters
Type Name Description
double g
Returns
Type Description
PdfColor

FromRgb(double, double, double)

RGB channels each 0.0 to 1.0.

Declaration
public static PdfColor FromRgb(double r, double g, double b)
Parameters
Type Name Description
double r
double g
double b
Returns
Type Description
PdfColor

GetHashCode()

Returns a hash code for this color.

Declaration
public override int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()

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
Type Name Description
double r
double g
double b
Returns
Type Description
bool

Operators

operator ==(PdfColor, PdfColor)

Indicates whether two PdfColor instances are equal.

Declaration
public static bool operator ==(PdfColor a, PdfColor b)
Parameters
Type Name Description
PdfColor a
PdfColor b
Returns
Type Description
bool

operator !=(PdfColor, PdfColor)

Indicates whether two PdfColor instances are not equal.

Declaration
public static bool operator !=(PdfColor a, PdfColor b)
Parameters
Type Name Description
PdfColor a
PdfColor b
Returns
Type Description
bool

Implements

IEquatable<T>
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX