Table of Contents

Class EllipticGradientBrush

Namespace
SixLabors.ImageSharp.Drawing.Processing
Assembly
SixLabors.ImageSharp.Drawing.dll

Provides an implementation of a brush for painting elliptical gradients. The ellipse is defined by a center point, a point on the longest axis, and the ratio between the longest and shortest axes.

public sealed class EllipticGradientBrush : GradientBrush, IEquatable<Brush>
Inheritance
EllipticGradientBrush
Implements
Inherited Members

Constructors

EllipticGradientBrush(PointF, PointF, float, GradientRepetitionMode, params ColorStop[])

Base class for Gradient brushes

public EllipticGradientBrush(PointF center, PointF referenceAxisEnd, float axisRatio, GradientRepetitionMode repetitionMode, params ColorStop[] colorStops)

Parameters

center PointF

The center of the elliptical gradient and 0 for the color stops.

referenceAxisEnd PointF

The end point of the reference axis of the ellipse.

axisRatio float

The ratio of the axis widths. The second axis is perpendicular to the reference axis and its length is the reference axis length multiplied by this factor.

repetitionMode GradientRepetitionMode

Defines how the colors of the gradients are repeated.

colorStops ColorStop[]

The color stops.

Properties

AxisRatio

Gets the ratio of the secondary axis to the primary axis.

public float AxisRatio { get; }

Property Value

float

Center

Gets the center of the ellipse.

public PointF Center { get; }

Property Value

PointF

ReferenceAxisEnd

Gets the end point of the reference axis.

public PointF ReferenceAxisEnd { get; }

Property Value

PointF

Methods

CreateRenderer<TPixel>(Configuration, GraphicsOptions, int, RectangleF)

Creates the prepared execution object for this brush.

public override BrushRenderer<TPixel> CreateRenderer<TPixel>(Configuration configuration, GraphicsOptions options, int canvasWidth, RectangleF region) where TPixel : unmanaged, IPixel<TPixel>

Parameters

configuration Configuration

The configuration instance to use when performing operations.

options GraphicsOptions

The graphic options.

canvasWidth int

The canvas width for the current render pass.

region RectangleF

The region the brush will be applied to.

Returns

BrushRenderer<TPixel>

The BrushRenderer<TPixel> for this brush.

Type Parameters

TPixel

The pixel type.

Remarks

The region when being applied to things like shapes would usually be the bounding box of the shape not necessarily the bounds of the whole image.

Transform(Matrix4x4)

Returns a new brush with its defining geometry transformed by the given matrix.

public override Brush Transform(Matrix4x4 matrix)

Parameters

matrix Matrix4x4

The transformation matrix to apply.

Returns

Brush

A transformed brush, or this if the brush has no spatial parameters.