Table of Contents

Struct XColor

Namespace
PdfSharp.Drawing
Assembly
PdfSharp.dll

Represents an RGB, CMYK, or gray scale color.

public struct XColor
Inherited Members

Fields

Empty

Represents the empty color.

public static readonly XColor Empty

Field Value

XColor

Properties

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

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

ColorSpace

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

public XColorSpace ColorSpace { get; set; }

Property Value

XColorSpace

G

Gets or sets the green value.

public byte G { get; set; }

Property Value

byte

GS

Gets or sets the gray scale value.

public double GS { get; set; }

Property Value

double

IsEmpty

Indicates whether this XColor structure is uninitialized.

public bool IsEmpty { get; }

Property Value

bool

IsKnownColor

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

public bool IsKnownColor { get; }

Property Value

bool

K

Gets or sets the black (or key) value.

public double K { get; set; }

Property Value

double

M

Gets or sets the magenta value.

public double M { get; set; }

Property Value

double

R

Gets or sets the red value.

public byte R { get; set; }

Property Value

byte

RgbCmykG

Special property for XmlSerializer only.

public string RgbCmykG { get; set; }

Property Value

string

Y

Gets or sets the yellow value.

public double Y { get; set; }

Property Value

double

Methods

Equals(object?)

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

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

FromArgb(int)

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

public static XColor FromArgb(int argb)

Parameters

argb int

Returns

XColor

FromArgb(int, XColor)

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

public static XColor FromArgb(int alpha, XColor color)

Parameters

alpha int
color XColor

Returns

XColor

FromArgb(int, int, int)

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

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

Parameters

red int
green int
blue int

Returns

XColor

FromArgb(int, int, int, int)

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

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

Parameters

alpha int
red int
green int
blue int

Returns

XColor

FromArgb(uint)

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

public static XColor FromArgb(uint argb)

Parameters

argb uint

Returns

XColor

FromCmyk(double, double, double, double)

Creates an XColor structure from the specified CMYK values.

public static 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.

public static 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.

public static XColor FromGrayScale(double grayScale)

Parameters

grayScale double

Returns

XColor

FromKnownColor(XKnownColor)

Creates an XColor from the specified pre-defined color.

public static XColor FromKnownColor(XKnownColor color)

Parameters

color XKnownColor

Returns

XColor

FromName(string)

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

[Obsolete("Not really implemented and not useful. See XColorResourceManager.")]
public static XColor FromName(string name)

Parameters

name string

Returns

XColor

GetBrightness()

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

public double GetBrightness()

Returns

double

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

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

GetHue()

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

public 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.

public 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.

Operators

operator ==(XColor, XColor)

Determines whether two colors are equal.

public static bool operator ==(XColor left, XColor right)

Parameters

left XColor
right XColor

Returns

bool

operator !=(XColor, XColor)

Determines whether two colors are not equal.

public static bool operator !=(XColor left, XColor right)

Parameters

left XColor
right XColor

Returns

bool