Struct ColorGradientAlphaStop
Represents a single alpha stop within a ColorGradient. Alpha stops define an independent transparency curve that is evaluated separately from the color stops and applied to the final output color.
Inherited Members
Namespace: Scylla.Core.Util.Palette
Assembly: ScyllaCore.dll
Syntax
public readonly struct ColorGradientAlphaStop : IEquatable<ColorGradientAlphaStop>, IComparable<ColorGradientAlphaStop>
Remarks
Independent alpha control. When a gradient has alpha stops, the alpha channel is evaluated from the alpha stop curve rather than from the color stops' alpha values. This enables the Photoshop-style workflow where color transitions and transparency transitions are controlled independently.
Value semantics. ColorGradientAlphaStop is a
readonly struct, providing zero-allocation, stack-allocated value semantics.
Ordering. Stops are ordered by Offset via IComparable<T>. The parent ColorGradient sorts alpha stops by offset at construction time.
Interpolation. Interpolation selects the easing curve applied to the segment between this stop and the next, mirroring the color-stop API. None (the default) produces a straight-line blend.
Midpoint. The Midpoint value shifts the interpolation balance point between this stop and its successor. A value of 0.5 (default) produces standard linear interpolation. Lower values shift the blend toward this stop, higher values toward the next.
Constructors
ColorGradientAlphaStop(float, float, ColorGradientStopInterpolation, float)
Creates a new alpha stop at the specified offset with the given alpha value and per-segment easing curve.
Declaration
public ColorGradientAlphaStop(float offset, float alpha, ColorGradientStopInterpolation interpolation, float midpoint = 0.5)
Parameters
| Type | Name | Description |
|---|---|---|
| float | offset | Normalized position along the gradient, must be in [0, 1]. |
| float | alpha | Alpha (opacity) value, must be in [0, 1]. |
| ColorGradientStopInterpolation | interpolation | Per-segment easing curve override. |
| float | midpoint | Interpolation midpoint between this stop and the next. Must be in (0, 1). Defaults to DEFAULT_MIDPOINT. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if |
ColorGradientAlphaStop(float, float, float)
Creates a new alpha stop at the specified offset with the given alpha value.
Declaration
public ColorGradientAlphaStop(float offset, float alpha, float midpoint = 0.5)
Parameters
| Type | Name | Description |
|---|---|---|
| float | offset | Normalized position along the gradient, must be in [0, 1]. |
| float | alpha | The alpha (opacity) value, must be in [0, 1]. |
| float | midpoint | The interpolation midpoint between this stop and the next. Must be in (0, 1). Defaults to DEFAULT_MIDPOINT. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown if |
Fields
DEFAULT_MIDPOINT
The default midpoint value (centered, no shift).
Declaration
public const float DEFAULT_MIDPOINT = 0.5
Field Value
| Type | Description |
|---|---|
| float |
Properties
Alpha
The alpha (opacity) value at this stop, in the range [0, 1]. A value of 0 is fully transparent, 1 is fully opaque.
Declaration
public float Alpha { get; }
Property Value
| Type | Description |
|---|---|
| float |
Interpolation
Per-segment easing curve applied to the transition from this stop to the next. Defaults to None (straight-line blend). Mirrors the color-stop API so authoring feels symmetric across the two rails.
Declaration
public ColorGradientStopInterpolation Interpolation { get; }
Property Value
| Type | Description |
|---|---|
| ColorGradientStopInterpolation |
Midpoint
The interpolation midpoint between this stop and its successor, in the range (0, 1). Defaults to DEFAULT_MIDPOINT (0.5). Shifting the midpoint changes where the 50% blend point falls in the transition.
Declaration
public float Midpoint { get; }
Property Value
| Type | Description |
|---|---|
| float |
Offset
The normalized position of this stop along the gradient, in the range [0, 1]. A value of 0 represents the start and 1 represents the end.
Declaration
public float Offset { get; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
CompareTo(ColorGradientAlphaStop)
Compares this stop with another by Offset for sorting.
Declaration
public int CompareTo(ColorGradientAlphaStop other)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorGradientAlphaStop | other | The stop to compare with. |
Returns
| Type | Description |
|---|---|
| int | A negative value if this stop's offset is less than |
Equals(ColorGradientAlphaStop)
Determines whether this stop is equal to another. Two alpha stops are equal if their offsets, alpha values, interpolation, and midpoints all match within float tolerance.
Declaration
public bool Equals(ColorGradientAlphaStop other)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorGradientAlphaStop | other | The stop to compare with. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToString()
Returns a human-readable string of this stop in the format
"0.50 (A=0.75, M=0.50)".
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
operator ==(ColorGradientAlphaStop, ColorGradientAlphaStop)
Equality operator comparing offset, alpha, interpolation, and midpoint.
Declaration
public static bool operator ==(ColorGradientAlphaStop left, ColorGradientAlphaStop right)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorGradientAlphaStop | left | |
| ColorGradientAlphaStop | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(ColorGradientAlphaStop, ColorGradientAlphaStop)
Inequality operator.
Declaration
public static bool operator !=(ColorGradientAlphaStop left, ColorGradientAlphaStop right)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorGradientAlphaStop | left | |
| ColorGradientAlphaStop | right |
Returns
| Type | Description |
|---|---|
| bool |