GradientStop Struct

A color at a position of a gradient.

public readonly struct GradientStop : IEquatable<GradientStop>
Implements

Constructors

NameDescription
GradientStop(double, Rgba64)Initializes a new instance of the GradientStop struct.

GradientStop(double, Rgba64)

GradientStop.cs

Initializes a new instance of the GradientStop struct.

public GradientStop(double offset, Rgba64 color)

Parameters

offset double
The position along the gradient, from 0 (its start) to 1 (its end).
color Rgba64
The color, with straight alpha. An Rgba32 converts implicitly.

Exceptions

ArgumentOutOfRangeException
offset is not between 0 and 1.

Properties

NameDescription
ColorGets the color, with straight alpha.
OffsetGets the position along the gradient, from 0 (its start) to 1 (its end).

Gets the color, with straight alpha.

public Rgba64 Color { get; }

Property value

Rgba64

Gets the position along the gradient, from 0 (its start) to 1 (its end).

public double Offset { get; }

Property value

double

Methods

NameDescription
Equals(GradientStop)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.
ToString()Returns the stop formatted as {Offset}: {Color}.

Equals overloads

Equals(GradientStop)

GradientStop.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(GradientStop other)
Parameters
other GradientStop
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

GradientStop.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

GradientStop.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

ToString()

GradientStop.cs

Returns the stop formatted as {Offset}: {Color}.

public override string ToString()

Returns

string A string representation of the stop.

Operators

NameDescription
operator ==(GradientStop, GradientStop)Compares two stops for equality.
operator !=(GradientStop, GradientStop)Compares two stops for inequality.

operator ==(GradientStop, GradientStop)

GradientStop.cs

Compares two stops for equality.

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

Parameters

left GradientStop
The first stop.
right GradientStop
The second stop.

Returns

bool true if both stops are equal; otherwise false.

operator !=(GradientStop, GradientStop)

GradientStop.cs

Compares two stops for inequality.

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

Parameters

left GradientStop
The first stop.
right GradientStop
The second stop.

Returns

bool true if the stops differ; otherwise false.