• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class LinearGradientBrush

Defines a brush that blends two colors along a linear gradient.

Inheritance
object
Brush
LinearGradientBrush
Implements
IDisposable
Inherited Members
Brush.Dispose()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing.Drawing2D
Assembly: DRIT.Drawing.dll
Syntax
public sealed class LinearGradientBrush : Brush, IDisposable
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Constructors

LinearGradientBrush(Point, Point, Color, Color)

Initializes a new LinearGradientBrush with the specified start and end points and colors.

Declaration
public LinearGradientBrush(Point pt1, Point pt2, Color color1, Color color2)
Parameters
Type Name Description
Point pt1

The starting point of the gradient.

Point pt2

The ending point of the gradient.

Color color1

The starting color.

Color color2

The ending color.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(PointF, PointF, Color, Color)

Initializes a new LinearGradientBrush with the specified start and end points and colors.

Declaration
public LinearGradientBrush(PointF pt1, PointF pt2, Color color1, Color color2)
Parameters
Type Name Description
PointF pt1

The starting point of the gradient.

PointF pt2

The ending point of the gradient.

Color color1

The starting color.

Color color2

The ending color.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(Rectangle, Color, Color, LinearGradientMode)

Initializes a new LinearGradientBrush with the specified rectangle and colors, using a gradient mode.

Declaration
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, LinearGradientMode mode)
Parameters
Type Name Description
Rectangle rect

The rectangle that defines the start and end points of the gradient.

Color color1

The starting color.

Color color2

The ending color.

LinearGradientMode mode

The linear gradient mode specifying the direction.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(Rectangle, Color, Color, float, bool)

Initializes a new LinearGradientBrush with the specified rectangle, colors, angle, and scaleability.

Declaration
public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScaleable)
Parameters
Type Name Description
Rectangle rect

The rectangle that defines the center of the gradient.

Color color1

The starting color.

Color color2

The ending color.

float angle

The angle of the gradient in degrees.

bool isAngleScaleable

If true, the angle scales with the shape.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(RectangleF, Color, Color, LinearGradientMode)

Initializes a new LinearGradientBrush with the specified rectangle and colors, using a gradient mode.

Declaration
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, LinearGradientMode mode)
Parameters
Type Name Description
RectangleF rect

The rectangle that defines the start and end points of the gradient.

Color color1

The starting color.

Color color2

The ending color.

LinearGradientMode mode

The linear gradient mode specifying the direction.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(RectangleF, Color, Color, float)

Initializes a new LinearGradientBrush with the specified rectangle, colors, and angle.

Declaration
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)
Parameters
Type Name Description
RectangleF rect

The rectangle that defines the center of the gradient.

Color color1

The starting color.

Color color2

The ending color.

float angle

The angle of the gradient in degrees.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearGradientBrush(RectangleF, Color, Color, float, bool)

Initializes a new LinearGradientBrush with the specified rectangle, colors, angle, and scaleability.

Declaration
public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScaleable)
Parameters
Type Name Description
RectangleF rect

The rectangle that defines the center of the gradient.

Color color1

The starting color.

Color color2

The ending color.

float angle

The angle of the gradient in degrees.

bool isAngleScaleable

If true, the angle scales with the shape.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Properties

Blend

Gets or sets the blend factors for custom gradient blending.

Declaration
public Blend? Blend { get; set; }
Property Value
Type Description
Blend
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

GammaCorrection

Gets or sets whether gamma correction is enabled for the gradient.

Declaration
public bool GammaCorrection { get; set; }
Property Value
Type Description
bool
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

InterpolationColors

Gets or sets the color blend for custom gradient interpolation.

Declaration
public ColorBlend InterpolationColors { get; set; }
Property Value
Type Description
ColorBlend
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

LinearColors

Gets or sets the starting and ending colors of the gradient.

Declaration
public Color[] LinearColors { get; set; }
Property Value
Type Description
Color[]
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Point1

Gets the starting point of the gradient.

Declaration
public PointF Point1 { get; }
Property Value
Type Description
PointF
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Point2

Gets the ending point of the gradient.

Declaration
public PointF Point2 { get; }
Property Value
Type Description
PointF
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Rectangle

Gets the rectangle that defines the bounds of this gradient brush.

Declaration
public RectangleF Rectangle { get; }
Property Value
Type Description
RectangleF
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Transform

Gets or sets the transformation matrix for this brush.

Declaration
public Matrix Transform { get; set; }
Property Value
Type Description
Matrix
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

WrapMode

Gets or sets the wrap mode for filling areas outside the gradient.

Declaration
public WrapMode WrapMode { get; set; }
Property Value
Type Description
WrapMode
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Methods

Clone()

Creates an exact copy of this LinearGradientBrush.

Declaration
public override Brush Clone()
Returns
Type Description
Brush

A new LinearGradientBrush with the same properties.

Overrides
Brush.Clone()
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Dispose(bool)

Releases the unmanaged and optionally the managed resources used by this LinearGradientBrush.

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

If true, releases both managed and unmanaged resources; if false, releases only unmanaged resources.

Overrides
Brush.Dispose(bool)
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

MultiplyTransform(Matrix, MatrixOrder)

Multiplies the transformation matrix by the specified matrix.

Declaration
public void MultiplyTransform(Matrix matrix, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
Matrix matrix

The matrix to multiply.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

ResetTransform()

Resets the transformation matrix to the identity matrix.

Declaration
public void ResetTransform()
Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

RotateTransform(float, MatrixOrder)

Rotates the transformation matrix by the specified angle.

Declaration
public void RotateTransform(float angle, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float angle

The angle of rotation in degrees.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

ScaleTransform(float, float, MatrixOrder)

Scales the transformation matrix by the specified factors.

Declaration
public void ScaleTransform(float sx, float sy, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float sx

The horizontal scale factor.

float sy

The vertical scale factor.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

SetBlendTriangularShape(float, float)

Creates a triangular blend that emphasizes colors at the specified focus.

Declaration
public void SetBlendTriangularShape(float focus, float scale = 1)
Parameters
Type Name Description
float focus

The focus position (0.0 to 1.0).

float scale

The scale factor for the blend.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

SetSigmaBellShape(float, float)

Creates a bell-shaped blend that emphasizes colors at the specified focus.

Declaration
public void SetSigmaBellShape(float focus, float scale = 1)
Parameters
Type Name Description
float focus

The focus position (0.0 to 1.0).

float scale

The scale factor for the blend.

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

TranslateTransform(float, float, MatrixOrder)

Translates the transformation matrix by the specified offsets.

Declaration
public void TranslateTransform(float dx, float dy, MatrixOrder order = MatrixOrder.Prepend)
Parameters
Type Name Description
float dx

The horizontal translation.

float dy

The vertical translation.

MatrixOrder order

The order of multiplication (prepend or append).

Remarks

A LinearGradientBrush fills shapes with a gradient that transitions linearly from a start point to an end point. The gradient can be customized with Blend and ColorBlend for non-linear interpolation.

Implements

IDisposable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX