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
RectangleThe 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
Rectangle
Gets the rectangle specifying the boundaries of the area in Buffer.
public Rectangle Rectangle { get; }
Property Value
Stride
Gets the pixel stride which is equal to the width of Buffer.
public int Stride { get; }
Property Value
Width
Gets the width
public int Width { get; }
Property Value
Methods
DangerousGetRowSpan(int)
Gets a span to row 'y' inside this area.
public Span<T> DangerousGetRowSpan(int y)
Parameters
y
intThe 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
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
intThe x index at the subregion origin.
y
intThe y index at the subregion origin.
width
intThe desired width of the subregion.
height
intThe desired height of the subregion.
Returns
- Buffer2DRegion<T>
The subregion