Class TilePngDecoder
Decodes 8-bit non-interlaced PNG tiles on a worker thread into packed RGBA.
public static class TilePngDecoder
- Inheritance
-
objectTilePngDecoder
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
databyte[]PNG bytes; only the first
lengthare read.lengthintValid byte count in
data.rgbabyte[]Output buffer, at least widthheight4 bytes, caller-owned.
widthintDecoded width in pixels on success.
heightintDecoded height in pixels on success.
reasonTilePngDecoder.FailReasonWhy decode failed; None on success.
Returns
- bool
True when
rgbaholds a full frame; never throws.