PixelAccessor<TPixel> Struct

  • Obsolete: Types with embedded references are not supported in this version of your compiler.

Scoped access to the rows of a frame, valid only during a ImageFrame<TPixel>.ProcessPixelRows callback.

[Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
public readonly ref struct PixelAccessor<TPixel> where TPixel : unmanaged

Type parameters

TPixel
The pixel type.

Remarks

Each row is contiguous and contains exactly PixelAccessor<TPixel>.Width visible pixels; consecutive rows are not guaranteed to be adjacent in memory. The accessor is bound to the lease of the callback: once the callback returns, PixelAccessor<TPixel>.GetRowSpan throws an InvalidOperationException. A default instance has no rows.

Properties

NameDescription
HeightGets the number of rows.
WidthGets the number of pixels per row.

Gets the number of rows.

public int Height { get; }

Property value

int

Gets the number of pixels per row.

public int Width { get; }

Property value

int

Methods

NameDescription
GetRowSpan(int)Gets a row of visible pixels.

Gets a row of visible pixels.

public Span<TPixel> GetRowSpan(int y)

Parameters

y int
The row index, from 0 to Height - 1.

Returns

Span<TPixel> A span of exactly PixelAccessor<TPixel>.Width pixels, valid until the callback returns.

Exceptions

ArgumentOutOfRangeException
y is out of range.
InvalidOperationException
The callback that received the accessor has returned.