Edit

HBColor Struct

Definition

Represents a 32-bit BGRA color value used by HarfBuzz.

public readonly struct HBColor : IEquatable<HarfBuzzSharp.HBColor>
Inheritance
HBColor
Implements

Examples

Creating a fully opaque red color and reading its components:

var red = new HBColor(255, 0, 0, 255);
Console.WriteLine(red.Red);   // 255
Console.WriteLine(red.Green); // 0
Console.WriteLine(red.Blue);  // 0
Console.WriteLine(red.Alpha); // 255
Console.WriteLine(red);       // #FFFF0000

Remarks

An `HBColor` stores a color as a packed 32-bit unsigned integer in BGRA byte order: bits 31–24 are blue, bits 23–16 are green, bits 15–8 are red, and bits 7–0 are alpha.

When formatted as a string, the color is expressed in `#AARRGGBB` hexadecimal notation matching the CSS convention.

Constructors

Name Description
HBColor(Byte, Byte, Byte, Byte)

Initializes a new instance of the HBColor struct from individual RGBA channel values.

HBColor(UInt32)

Initializes a new instance of the HBColor struct from a raw 32-bit BGRA value.

Properties

Name Description
Alpha

Gets the alpha component of the color.

Blue

Gets the blue component of the color.

Green

Gets the green component of the color.

Red

Gets the red component of the color.

Value

Gets the underlying packed BGRA value of this color.

Methods

Name Description
Equals(HBColor)

Indicates whether this color is equal to another HBColor.

Equals(Object)

Determines whether the specified object is equal to the current color.

GetHashCode()

Returns a hash code for this color.

ToString()

Returns a hexadecimal string representation of this color.

Operators

Name Description
Equality(HBColor, HBColor)

Determines whether two HBColor values are equal.

Explicit(UInt32 to HBColor)

Explicitly converts a packed BGRA integer value to an HBColor.

Implicit(HBColor to UInt32)

Implicitly converts an HBColor to a packed BGRA integer value.

Inequality(HBColor, HBColor)

Determines whether two HBColor values are not equal.

Applies to