Class PatternBrush
Provides an implementation of a pattern brush for painting patterns.
Inherited Members
Namespace: SixLabors.ImageSharp.Drawing.Processing
Assembly: SixLabors.ImageSharp.Drawing.dll
Syntax
public sealed class PatternBrush : Brush
Remarks
The patterns that are used to create a custom pattern brush are made up of a repeating matrix of flags, where each flag denotes whether to draw the foreground color or the background color. so to create a new bool[,] with your flags
For example if you wanted to create a diagonal line that repeat every 4 pixels you would use a pattern like so 1000 0100 0010 0001
or you want a horizontal stripe which is 3 pixels apart you would use a pattern like 1 0 0
Constructors
| Improve this Doc View SourcePatternBrush(Color, Color, Boolean[,])
Initializes a new instance of the PatternBrush class.
Declaration
public PatternBrush(Color foreColor, Color backColor, bool[, ] pattern)
Parameters
Type | Name | Description |
---|---|---|
Color | foreColor | Color of the fore. |
Color | backColor | Color of the back. |
Boolean[,] | pattern | The pattern. |
Methods
| Improve this Doc View SourceCreateApplicator<TPixel>(Configuration, GraphicsOptions, ImageFrame<TPixel>, RectangleF)
Creates the applicator for this brush.
Declaration
public override BrushApplicator<TPixel> CreateApplicator<TPixel>(Configuration configuration, GraphicsOptions options, ImageFrame<TPixel> source, RectangleF region)
where TPixel : struct, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
Configuration | configuration | The configuration instance to use when performing operations. |
GraphicsOptions | options | The graphic options. |
ImageFrame<TPixel> | source | The source image. |
RectangleF | region | The region the brush will be applied to. |
Returns
Type | Description |
---|---|
BrushApplicator<TPixel> | The BrushApplicator<TPixel> for this brush. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel type. |
Overrides
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.
Equals(Brush)
Declaration
public override bool Equals(Brush other)
Parameters
Type | Name | Description |
---|---|---|
Brush | other |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |