Class PathGradientBrush
Encapsulates a Brush object that creates a gradient using the center point and the vertices of the path defining the gradient shape.
Implements
Inherited Members
Namespace: DRIT.Drawing.Drawing2D
Assembly: DRIT.Drawing.dll
Syntax
public sealed class PathGradientBrush : Brush, IDisposable
Constructors
PathGradientBrush(GraphicsPath)
Initializes a new PathGradientBrush from the specified path.
Declaration
public PathGradientBrush(GraphicsPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsPath | path | The path that defines the gradient shape. |
PathGradientBrush(GraphicsPath, WrapMode)
Initializes a new PathGradientBrush from the specified path and wrap mode.
Declaration
public PathGradientBrush(GraphicsPath path, WrapMode wrapMode)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsPath | path | The path that defines the gradient shape. |
| WrapMode | wrapMode | The wrap mode that determines how the gradient is tiled. |
PathGradientBrush(PointF[])
Initializes a new PathGradientBrush with the specified points.
Declaration
public PathGradientBrush(PointF[] points)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF[] | points | The array of points that define the gradient path. |
PathGradientBrush(PointF[], WrapMode)
Initializes a new PathGradientBrush with the specified points and wrap mode.
Declaration
public PathGradientBrush(PointF[] points, WrapMode wrapMode)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF[] | points | The array of points that define the gradient path. |
| WrapMode | wrapMode | The wrap mode that determines how the gradient is tiled. |
Properties
Blend
Gets or sets the blend factors for custom gradient blending.
Declaration
public Blend? Blend { get; set; }
Property Value
| Type | Description |
|---|---|
| Blend |
CenterColor
Gets or sets the center color of the gradient.
Declaration
public Color CenterColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
CenterPoint
Gets or sets the center point of the gradient.
Declaration
public PointF CenterPoint { get; set; }
Property Value
| Type | Description |
|---|---|
| PointF |
FocusScales
Gets or sets the focus scales for the gradient.
Declaration
public PointF FocusScales { get; set; }
Property Value
| Type | Description |
|---|---|
| PointF |
InterpolationColors
Gets or sets the color blend for custom gradient interpolation.
Declaration
public ColorBlend? InterpolationColors { get; set; }
Property Value
| Type | Description |
|---|---|
| ColorBlend |
Rectangle
Gets the bounding rectangle of the gradient path.
Declaration
public RectangleF Rectangle { get; }
Property Value
| Type | Description |
|---|---|
| RectangleF |
SurroundColors
Gets or sets the array of surround colors.
Declaration
public Color[] SurroundColors { get; set; }
Property Value
| Type | Description |
|---|---|
| Color[] |
Transform
Gets or sets the transformation matrix for the brush.
Declaration
public Matrix Transform { get; set; }
Property Value
| Type | Description |
|---|---|
| Matrix |
WrapMode
Gets or sets the wrap mode for filling areas outside the gradient.
Declaration
public WrapMode WrapMode { get; set; }
Property Value
| Type | Description |
|---|---|
| WrapMode |
Methods
Clone()
Creates an exact copy of this PathGradientBrush.
Declaration
public override Brush Clone()
Returns
| Type | Description |
|---|---|
| Brush | A new PathGradientBrush with the same properties. |
Overrides
Dispose(bool)
Releases the unmanaged resources used by the PathGradientBrush.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
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). |
ResetTransform()
Resets the transformation matrix to the identity matrix.
Declaration
public void ResetTransform()
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). |
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). |
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. |
SetSigmaBellShape(float, float)
Creates a bell-shaped blend centered 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. |
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). |