PixelBytesAccessor Struct

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

Scoped access to the raw bytes of the rows of a frame, valid only during a ImageFrame.ProcessPixelBytes callback.

[Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
public readonly ref struct PixelBytesAccessor

Remarks

Each row is contiguous and contains exactly PixelBytesAccessor.RowLength bytes of visible pixels; 16-bit components are in native endianness. The accessor is bound to the lease of the callback: once the callback returns, PixelBytesAccessor.GetRowSpan throws an InvalidOperationException. A default instance has no rows.

Properties

NameDescription
HeightGets the number of rows.
PixelFormatGets the pixel format describing the byte layout.
RowLengthGets the number of visible bytes per row (Width * bytesPerPixel).
WidthGets the number of pixels per row.

Gets the number of rows.

public int Height { get; }

Property value

int

Gets the pixel format describing the byte layout.

public PixelFormat PixelFormat { get; }

Property value

PixelFormat

Gets the number of visible bytes per row (Width * bytesPerPixel).

public int RowLength { get; }

Property value

int

Gets the number of pixels per row.

public int Width { get; }

Property value

int

Methods

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

GetRowSpan(int)

PixelBytesAccessor.cs

Gets the bytes of a row of visible pixels.

public Span<byte> GetRowSpan(int y)

Parameters

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

Returns

Span<byte> A span of exactly PixelBytesAccessor.RowLength bytes, valid until the callback returns.

Exceptions

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