Table of Contents

Class TilePngDecoder

Namespace
LansMap.Core.Decode

Decodes 8-bit non-interlaced PNG tiles on a worker thread into packed RGBA.

public static class TilePngDecoder
Inheritance
object
TilePngDecoder

Remarks

Color types 0 (grey), 2 (RGB), 3 (palette), 4 (grey+alpha), and 6 (RGBA). 16-bit depth and Adam7 interlacing return false with Unsupported rather than throwing. A corrupt or truncated payload also returns false, never an exception through a worker thread.

Methods

TryDecode(byte[], int, byte[], out int, out int, out FailReason)

Decodes an 8-bit non-interlaced PNG into packed 8-bit RGBA.

public static bool TryDecode(byte[] data, int length, byte[] rgba, out int width, out int height, out TilePngDecoder.FailReason reason)

Parameters

data byte[]

PNG bytes; only the first length are read.

length int

Valid byte count in data.

rgba byte[]

Output buffer, at least widthheight4 bytes, caller-owned.

width int

Decoded width in pixels on success.

height int

Decoded height in pixels on success.

reason TilePngDecoder.FailReason

Why decode failed; None on success.

Returns

bool

True when rgba holds a full frame; never throws.