Table of Contents

Class ImageBrush

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

The untyped base class for image brushes, used to support non-generic brush references in drawing contexts.

public abstract class ImageBrush : Brush, IEquatable<Brush>
Inheritance
ImageBrush
Implements
Derived
Inherited Members

Constructors

ImageBrush(Image)

Initializes a new instance of the ImageBrush class.

protected ImageBrush(Image image)

Parameters

image Image

The source image to draw.

ImageBrush(Image, Point)

Initializes a new instance of the ImageBrush class.

protected ImageBrush(Image image, Point offset)

Parameters

image Image

The image.

offset Point

An offset to apply the to image image while drawing apply the texture.

ImageBrush(Image, RectangleF)

Initializes a new instance of the ImageBrush class.

protected ImageBrush(Image image, RectangleF region)

Parameters

image Image

The image.

region RectangleF

The region of interest. This overrides any region used to initialize the brush applicator.

ImageBrush(Image, RectangleF, Point)

Initializes a new instance of the ImageBrush class.

protected ImageBrush(Image image, RectangleF region, Point offset)

Parameters

image Image

The image.

region RectangleF

The region of interest. This overrides any region used to initialize the brush applicator.

offset Point

An offset to apply the to image image while drawing apply the texture.

Properties

Offset

Gets the offset applied to the brush origin.

public Point Offset { get; }

Property Value

Point

SourceRegion

Gets the source region within the image.

public RectangleF SourceRegion { get; }

Property Value

RectangleF

UntypedImage

Gets the source image used by this brush.

public Image UntypedImage { get; }

Property Value

Image

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.

Equals(Brush?)

Indicates whether the current object is equal to another object of the same type.

public override bool Equals(Brush? other)

Parameters

other Brush

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.