Class TileRgb565Packer
- Namespace
- LansMap.Core.TileCodecs
Packs decoded RGBA8 tile pixels into RGB565 on a worker thread, so residency conversion does not cost main-thread per-pixel work.
public static class TileRgb565Packer
- Inheritance
-
objectTileRgb565Packer
Remarks
Channels use the documented R5G6B5 bit positions and truncate to the available precision. A GPU upload path that rounds instead of truncating can differ by one least-significant bit.
Fields
BytesPerPixel
Packed RGB565 size, 2 bytes per pixel.
public const int BytesPerPixel = 2
Field Value
Methods
PackBuffer(byte[], int, int, byte[], int)
Packs RGBA8 pixels into RGB565, 2 bytes per pixel, little-endian.
public static void PackBuffer(byte[] src, int srcOffset, int pixelCount, byte[] dest, int destOffset)
Parameters
srcbyte[]RGBA8 source, 4 bytes per pixel; alpha ignored.
srcOffsetintIndex of the first pixel's R in
src.pixelCountintPixels to pack.
destbyte[]Caller-owned destination, at least pixelCount*2 bytes from
destOffset.destOffsetintStart write index in
dest, in bytes.
PackPixel(byte, byte, byte)
Packs one pixel: 8-bit channels in, one 16-bit RGB565 value out.
public static ushort PackPixel(byte r, byte g, byte b)
Parameters
rbyteRed, 0 to 255; top 5 bits kept.
gbyteGreen, 0 to 255; top 6 bits kept.
bbyteBlue, 0 to 255; top 5 bits kept.
Returns
- ushort
Packed 16-bit RGB565. Alpha is dropped; RGB565 carries none.