Class GradientBrush
- Namespace
- SixLabors.ImageSharp.Drawing.Processing
- Assembly
- SixLabors.ImageSharp.Drawing.dll
Base class for gradient brushes. Derived brushes define a parameterization that maps each point to a scalar gradient position; this base class maps that position to a color via the sorted color stops and the GradientRepetitionMode.
public abstract class GradientBrush : Brush, IEquatable<Brush>
- Inheritance
-
GradientBrush
- Implements
- Derived
- Inherited Members
Constructors
GradientBrush(GradientRepetitionMode, params ColorStop[])
Initializes a new instance of the GradientBrush class.
protected GradientBrush(GradientRepetitionMode repetitionMode, params ColorStop[] colorStops)
Parameters
repetitionModeGradientRepetitionModeDefines how the colors are repeated beyond the interval [0..1].
colorStopsColorStop[]The gradient colors.
GradientBrush(GradientRepetitionMode, Matrix4x4, params ColorStop[])
Initializes a new instance of the GradientBrush class.
protected GradientBrush(GradientRepetitionMode repetitionMode, Matrix4x4 gradientTransform, params ColorStop[] colorStops)
Parameters
repetitionModeGradientRepetitionModeDefines how the colors are repeated beyond the interval [0..1].
gradientTransformMatrix4x4The transform from the gradient's coordinate space to the drawing.
colorStopsColorStop[]The gradient colors.
Properties
ColorStops
Gets the color stops for this gradient.
public ReadOnlySpan<ColorStop> ColorStops { get; }
Property Value
ColorStopsArray
Gets the color stops array for use by derived applicators.
protected ColorStop[] ColorStopsArray { get; }
Property Value
GradientTransform
Gets the transform from the gradient's coordinate space to the drawing. The geometry of the gradient is defined in its own space and every sample is mapped through the inverse of this transform, so a skew or a non-uniform scale changes the shape of the gradient. The transform is affine: a projective transform applied through Transform(Matrix4x4, Rectangle, Rectangle) projects the geometry point by point instead, because an affine gradient cannot express perspective.
public Matrix4x4 GradientTransform { get; }
Property Value
RepetitionMode
Gets how the colors are repeated beyond the interval [0..1].
public GradientRepetitionMode RepetitionMode { get; }
Property Value
Methods
Equals(Brush?)
Indicates whether the current object is equal to another object of the same type.
public override bool Equals(Brush? other)
Parameters
otherBrushAn object to compare with this object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.