Class TextureBrush
Fills the interior of a shape with an image, optionally tiling/wrapping it.
Implements
Inherited Members
Namespace: DRIT.Drawing.Brushes
Assembly: DRIT.Drawing.dll
Syntax
public sealed class TextureBrush : Brush, IDisposable
Constructors
TextureBrush(Image)
Initializes a new TextureBrush with the specified image and default wrap mode.
Declaration
public TextureBrush(Image image)
Parameters
| Type | Name | Description |
|---|---|---|
| Image | image | The image to fill the brush with. |
TextureBrush(Image, WrapMode)
Initializes a new TextureBrush with the specified image and wrap mode.
Declaration
public TextureBrush(Image image, WrapMode wrapMode)
Parameters
| Type | Name | Description |
|---|---|---|
| Image | image | The image to fill the brush with. |
| WrapMode | wrapMode | The wrap mode specifying how the image is tiled. |
TextureBrush(Image, RectangleF)
Initializes a new TextureBrush with the specified image and destination rectangle.
Declaration
public TextureBrush(Image image, RectangleF dstRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Image | image | The image to fill the brush with. |
| RectangleF | dstRect | The destination rectangle. |
TextureBrush(Image, RectangleF, ImageAttributes?)
Initializes a new TextureBrush with the specified image, destination rectangle, and image attributes.
Declaration
public TextureBrush(Image image, RectangleF dstRect, ImageAttributes? imageAttrs)
Parameters
| Type | Name | Description |
|---|---|---|
| Image | image | The image to fill the brush with. |
| RectangleF | dstRect | The destination rectangle. |
| ImageAttributes | imageAttrs | The image attributes. |
Properties
Image
Gets the image associated with this TextureBrush.
Declaration
public Image Image { get; }
Property Value
| Type | Description |
|---|---|
| Image |
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 tiling the image.
Declaration
public WrapMode WrapMode { get; set; }
Property Value
| Type | Description |
|---|---|
| WrapMode |
Methods
Clone()
Creates an exact copy of this TextureBrush.
Declaration
public override Brush Clone()
Returns
| Type | Description |
|---|---|
| Brush | A new TextureBrush with the same properties. |
Overrides
Dispose(bool)
Releases the unmanaged resources used by the TextureBrush.
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). |
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). |