Table of Contents

Struct Buffer2DRegion<T>

Namespace
SixLabors.ImageSharp.Memory
Assembly
SixLabors.ImageSharp.dll

Represents a rectangular region inside a 2D memory buffer (Buffer2D<T>).

public readonly struct Buffer2DRegion<T> where T : unmanaged

Type Parameters

T

The element type.

Inherited Members

Constructors

Buffer2DRegion(Buffer2D<T>)

Initializes a new instance of the Buffer2DRegion<T> struct.

public Buffer2DRegion(Buffer2D<T> buffer)

Parameters

buffer Buffer2D<T>

The Buffer2D<T>.

Buffer2DRegion(Buffer2D<T>, Rectangle)

Initializes a new instance of the Buffer2DRegion<T> struct.

public Buffer2DRegion(Buffer2D<T> buffer, Rectangle rectangle)

Parameters

buffer Buffer2D<T>

The Buffer2D<T>.

rectangle Rectangle

The Rectangle defining a rectangular area within the buffer.

Properties

Buffer

Gets the Buffer2D<T> being pointed by this instance.

public Buffer2D<T> Buffer { get; }

Property Value

Buffer2D<T>

Height

Gets the height

public int Height { get; }

Property Value

int

Rectangle

Gets the rectangle specifying the boundaries of the area in Buffer.

public Rectangle Rectangle { get; }

Property Value

Rectangle

Stride

Gets the pixel stride which is equal to the width of Buffer.

public int Stride { get; }

Property Value

int

Width

Gets the width

public int Width { get; }

Property Value

int

Methods

DangerousGetRowSpan(int)

Gets a span to row 'y' inside this area.

public Span<T> DangerousGetRowSpan(int y)

Parameters

y int

The row index

Returns

Span<T>

The span

GetSubRegion(Rectangle)

Returns a subregion as Buffer2DRegion<T>. (Similar to Slice(int, int).)

public Buffer2DRegion<T> GetSubRegion(Rectangle rectangle)

Parameters

rectangle Rectangle

The Rectangle specifying the boundaries of the subregion

Returns

Buffer2DRegion<T>

The subregion

GetSubRegion(int, int, int, int)

Returns a subregion as Buffer2DRegion<T>. (Similar to Slice(int, int).)

public Buffer2DRegion<T> GetSubRegion(int x, int y, int width, int height)

Parameters

x int

The x index at the subregion origin.

y int

The y index at the subregion origin.

width int

The desired width of the subregion.

height int

The desired height of the subregion.

Returns

Buffer2DRegion<T>

The subregion