PdfColor struct
Namespace: PdfNetStack.Drawing
Assembly: PdfNetStack.dll
Package: PdfNetStack
A device color with an opacity. Components are 0 to 1. Opacity below 1 is written as a constant alpha graphics state.
public readonly struct PdfColor : IEquatable<PdfColor>Implements
Properties
Section titled “Properties”Opacity, 0 transparent to 1 opaque.
public double Alpha { get; }Property Value
Section titled “Property Value”Opaque black.
public static PdfColor Black { get; }Property Value
Section titled “Property Value”The color model.
public PdfColorSpace Space { get; }Property Value
Section titled “Property Value”Transparent
Section titled “ Transparent”Fully transparent.
public static PdfColor Transparent { get; }Property Value
Section titled “Property Value”Opaque white.
public static PdfColor White { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Cmyk(double, double, double, double, double)
Section titled “ Cmyk(double, double, double, double, double)”A CMYK color with components 0 to 1.
public static PdfColor Cmyk(double cyan, double magenta, double yellow, double black, double alpha = 1)Parameters
Section titled “Parameters”cyan double
magenta double
yellow double
black double
alpha double
Returns
Section titled “Returns”Components()
Section titled “ Components()”The components in the order the color space defines: 1, 3 or 4 values.
public double[] Components()Returns
Section titled “Returns”double[]
Equals(PdfColor)
Section titled “ Equals(PdfColor)”Indicates whether the current object is equal to another object of the same type.
public bool Equals(PdfColor other)Parameters
Section titled “Parameters”other PdfColor
An object to compare with this object.
Returns
Section titled “Returns”true if the current object is equal to the other parameter; otherwise, false.
Equals(object?)
Section titled “ Equals(object?)”Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
The object to compare with the current instance.
Returns
Section titled “Returns”true if obj and this instance are the same type and represent the same value; otherwise, false.
FromHex(string)
Section titled “ FromHex(string)”Parses #RGB, #RGBA, #RRGGBB or #RRGGBBAA, with or without the hash.
public static PdfColor FromHex(string hex)Parameters
Section titled “Parameters”hex string
Returns
Section titled “Returns”Exceptions
Section titled “Exceptions”The text is not a hex color.
FromRgb(byte, byte, byte, double)
Section titled “ FromRgb(byte, byte, byte, double)”An RGB color with components 0 to 255, as in CSS and most image tools.
public static PdfColor FromRgb(byte red, byte green, byte blue, double alpha = 1)Parameters
Section titled “Parameters”red byte
green byte
blue byte
alpha double
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”Returns the hash code for this instance.
public override int GetHashCode()Returns
Section titled “Returns”A 32-bit signed integer that is the hash code for this instance.
Gray(double, double)
Section titled “ Gray(double, double)”A gray level, 0 black to 1 white.
public static PdfColor Gray(double level, double alpha = 1)Parameters
Section titled “Parameters”level double
alpha double
Returns
Section titled “Returns”Rgb(double, double, double, double)
Section titled “ Rgb(double, double, double, double)”An RGB color with components 0 to 1.
public static PdfColor Rgb(double red, double green, double blue, double alpha = 1)Parameters
Section titled “Parameters”red double
green double
blue double
alpha double
Returns
Section titled “Returns”ToRgb()
Section titled “ ToRgb()”The color converted to RGB (CMYK by the naive formula, without a color profile).
public PdfColor ToRgb()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”Returns the fully qualified type name of this instance.
public override string ToString()Returns
Section titled “Returns”The fully qualified type name.
WithAlpha(double)
Section titled “ WithAlpha(double)”The same color with another opacity.
public PdfColor WithAlpha(double alpha)Parameters
Section titled “Parameters”alpha double
Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(PdfColor, PdfColor)
Section titled “ operator ==(PdfColor, PdfColor)”Equality.
public static bool operator ==(PdfColor left, PdfColor right)Parameters
Section titled “Parameters”left PdfColor
right PdfColor
Returns
Section titled “Returns”operator !=(PdfColor, PdfColor)
Section titled “ operator !=(PdfColor, PdfColor)”Inequality.
public static bool operator !=(PdfColor left, PdfColor right)Parameters
Section titled “Parameters”left PdfColor
right PdfColor
Returns
Section titled “Returns”Used in
Section titled “Used in”- PDF coordinates and units in PdfNetStack
- Get started with PdfNetStack
- PDF links and annotations in C# and .NET
- Compress PDF files in C# and .NET
- Draw on PDF pages in C# and .NET
- Extract text from PDF files in C#
- Fonts and text in PDF with C# and .NET
- Fill and create PDF forms in C# and .NET
- Add images to PDF in C# and .NET
- Create PDF/A files in C# and .NET
- Add page numbers to a PDF in C#
- Add a signature field to a PDF in C#
- Add a watermark to a PDF in C#
- Create a Factur-X invoice PDF in C#