PDFsharp-net6

XColor

Namespace: PdfSharp.Drawing

Represents an RGB, CMYK, or gray scale color.

public struct XColor

Inheritance ObjectValueTypeXColor

Fields

Empty

Represents the empty color.

public static XColor Empty;

Properties

ColorSpace

Gets or sets the color space to be used for PDF generation.

public XColorSpace ColorSpace { get; set; }

Property Value

XColorSpace

IsEmpty

Indicates whether this XColor structure is uninitialized.

public bool IsEmpty { get; }

Property Value

Boolean

IsKnownColor

Gets a value indicating whether this color is a known color.

public bool IsKnownColor { get; }

Property Value

Boolean

A

Gets or sets the alpha value the specifies the transparency. The value is in the range from 1 (opaque) to 0 (completely transparent).

public double A { get; set; }

Property Value

Double

R

Gets or sets the red value.

public byte R { get; set; }

Property Value

Byte

G

Gets or sets the green value.

public byte G { get; set; }

Property Value

Byte

B

Gets or sets the blue value.

public byte B { get; set; }

Property Value

Byte

C

Gets or sets the cyan value.

public double C { get; set; }

Property Value

Double

M

Gets or sets the magenta value.

public double M { get; set; }

Property Value

Double

Y

Gets or sets the yellow value.

public double Y { get; set; }

Property Value

Double

K

Gets or sets the black (or key) value.

public double K { get; set; }

Property Value

Double

GS

Gets or sets the gray scale value.

public double GS { get; set; }

Property Value

Double

RgbCmykG

Special property for XmlSerializer only.

public string RgbCmykG { get; set; }

Property Value

String

Methods

FromArgb(Int32)

Creates an XColor structure from a 32-bit ARGB value.

XColor FromArgb(int argb)

Parameters

argb Int32

Returns

XColor

FromArgb(UInt32)

Creates an XColor structure from a 32-bit ARGB value.

XColor FromArgb(uint argb)

Parameters

argb UInt32

Returns

XColor

FromArgb(Int32, Int32, Int32)

Creates an XColor structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (fully opaque).

XColor FromArgb(int red, int green, int blue)

Parameters

red Int32

green Int32

blue Int32

Returns

XColor

FromArgb(Int32, Int32, Int32, Int32)

Creates an XColor structure from the four ARGB component (alpha, red, green, and blue) values.

XColor FromArgb(int alpha, int red, int green, int blue)

Parameters

alpha Int32

red Int32

green Int32

blue Int32

Returns

XColor

FromArgb(Int32, XColor)

Creates an XColor structure from the specified alpha value and color.

XColor FromArgb(int alpha, XColor color)

Parameters

alpha Int32

color XColor

Returns

XColor

FromCmyk(Double, Double, Double, Double)

Creates an XColor structure from the specified CMYK values.

XColor FromCmyk(double cyan, double magenta, double yellow, double black)

Parameters

cyan Double

magenta Double

yellow Double

black Double

Returns

XColor

FromCmyk(Double, Double, Double, Double, Double)

Creates an XColor structure from the specified CMYK values.

XColor FromCmyk(double alpha, double cyan, double magenta, double yellow, double black)

Parameters

alpha Double

cyan Double

magenta Double

yellow Double

black Double

Returns

XColor

FromGrayScale(Double)

Creates an XColor structure from the specified gray value.

XColor FromGrayScale(double grayScale)

Parameters

grayScale Double

Returns

XColor

FromKnownColor(XKnownColor)

Creates an XColor from the specified pre-defined color.

XColor FromKnownColor(XKnownColor color)

Parameters

color XKnownColor

Returns

XColor

FromName(String)

Caution

Not really implemented and not useful. See XColorResourceManager.


Creates an XColor from the specified name of a pre-defined color.

XColor FromName(string name)

Parameters

name String

Returns

XColor

Equals(Object)

Determines whether the specified object is a Color structure and is equivalent to this Color structure.

bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

GetHashCode()

Returns the hash code for this instance.

int GetHashCode()

Returns

Int32

GetHue()

Gets the hue-saturation-brightness (HSB) hue value, in degrees, for this color.

double GetHue()

Returns

Double
The hue, in degrees, of this color. The hue is measured in degrees, ranging from 0 through 360, in HSB color space.

GetSaturation()

Gets the hue-saturation-brightness (HSB) saturation value for this color.

double GetSaturation()

Returns

Double
The saturation of this color. The saturation ranges from 0 through 1, where 0 is grayscale and 1 is the most saturated.

GetBrightness()

Gets the hue-saturation-brightness (HSB) brightness value for this color.

double GetBrightness()

Returns

Double
The brightness of this color. The brightness ranges from 0 through 1, where 0 represents black and 1 represents white.