Table of Contents

Enum DecodeStatus

Namespace
Egami
Assembly
Egami.dll

Where a RasterDecoder stands, as Status reports it.

public enum DecodeStatus

Fields

Completed = 3

Every frame has been read.

FrameEnded = 2

Every row of the current frame has been read; NextFrame() moves to the next.

NeedsInput = 1

An incremental decode needs more bytes to go on: the header, or the next rows or frame. Append them.

RowsAvailable = 0

Rows of the current frame can be read.

Examples

// Decode while the bytes arrive, a chunk at a time, as from a download.
using RasterDecoder decoder = RasterDecoder.OpenIncremental();
Raster<Rgb8>? band = null;
foreach (ReadOnlyMemory<byte> chunk in file.Chunk(4096).Select(c => new ReadOnlyMemory<byte>(c)))
{
    decoder.Append(chunk.Span);
    if (decoder.HeaderRead)
    {
        band ??= Raster.Create<Rgb8>(decoder.Info.Width, 16);
        int rows;
        while ((rows = decoder.ReadRows(band)) > 0)
        {
            rowsSoFar += rows; // the rows finished so far; an interlaced file shows RenderPreview instead
        }
    }
}

decoder.EndOfInput();
while (decoder.ReadRows(band!) is int rest and > 0)
{
    rowsSoFar += rest;
}

band?.Dispose();