Table of Contents

Class PNGParser

Namespace
Map.Loading.Images
Assembly
MapAssembly.dll

High-performance PNG file parser for map files Supports 8-bit indexed, 24-bit RGB, and 32-bit RGBA formats Uses managed decompression but NativeArray for pixel storage

public static class PNGParser
Inheritance
object
PNGParser

Methods

CollectUniqueColors(PNGPixelData, Allocator)

Scan all pixels and collect unique RGB values

public static NativeHashSet<int> CollectUniqueColors(PNGParser.PNGPixelData pixelData, Allocator allocator)

Parameters

pixelData PNGParser.PNGPixelData
allocator Allocator

Returns

NativeHashSet<int>

FindPixelsWithColor(PNGPixelData, int, Allocator)

Find all pixels with a specific RGB color

public static NativeList<PixelCoord> FindPixelsWithColor(PNGParser.PNGPixelData pixelData, int targetRGB, Allocator allocator)

Parameters

pixelData PNGParser.PNGPixelData
targetRGB int
allocator Allocator

Returns

NativeList<PixelCoord>

IsPNG(NativeArray<byte>)

Check if file data is a valid PNG

public static bool IsPNG(NativeArray<byte> fileData)

Parameters

fileData NativeArray<byte>

Returns

bool

Parse(NativeArray<byte>, Allocator)

Parse and decode entire PNG file

public static PNGParser.PNGPixelData Parse(NativeArray<byte> fileData, Allocator allocator)

Parameters

fileData NativeArray<byte>
allocator Allocator

Returns

PNGParser.PNGPixelData

ParseHeader(NativeArray<byte>)

Parse PNG header from file data

public static PNGParser.PNGHeader ParseHeader(NativeArray<byte> fileData)

Parameters

fileData NativeArray<byte>

Returns

PNGParser.PNGHeader

TryGetPixelRGB(PNGPixelData, int, int, out byte, out byte, out byte)

Get RGB color at specific pixel coordinates

public static bool TryGetPixelRGB(PNGParser.PNGPixelData pixelData, int x, int y, out byte r, out byte g, out byte b)

Parameters

pixelData PNGParser.PNGPixelData
x int
y int
r byte
g byte
b byte

Returns

bool

TryGetPixelRGBPacked(PNGPixelData, int, int, out int)

Get packed RGB color (0xRRGGBB) at specific coordinates

public static bool TryGetPixelRGBPacked(PNGParser.PNGPixelData pixelData, int x, int y, out int rgb)

Parameters

pixelData PNGParser.PNGPixelData
x int
y int
rgb int

Returns

bool