code wiki / (root) / nx_bmp_decode.nx

nx_bmp_decode.nx

buildroot/runtime/nx_bmp_decode.nx

5528 B138 linesdepth 2pulls 2 transitivereach 37 importersview sourcekind librarytopic bmp
docsdependenciesstructsconstsfunctions

about

nx_bmp_decode.nx -- sovereign BMP READER (the 1990s Windows workhorse; the tree had only the writer nx_bmp.nx). bmp_decode_rgb(raw,n,out_wh) -> w*h*3 packed RGB, TOP-DOWN row order. Covers: BITMAPINFOHEADER (biSize>=40), bit depths 1/4/8 (palette), 24 (BGR), 32 (BGRX); BI_RGB (0) for all depths + BI_RLE8 (1) for 8-bit (runs, absolute mode, EOL/EOD/delta escapes); positive height = bottom-up (flipped here), negative = top-down. REFUSED (0 return, never a wrong image): BITMAPCOREHEADER, BI_RLE4, BI_BITFIELDS, 16-bit. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_bmp_decode.nx nx_bmp_tiff_gate.nx nx_img_bytes_to_rgb.nx

imports: nx_syscalls.nx

imported by: nx_bmp_tiff_gate.nxnx_img_bytes_to_rgb.nx

structs

none

consts

8const K_MAGIC_2147483648: i64 = 2147483648
9const K_MAGIC_4294967296: i64 = 4294967296
10const K_MAGIC_32767: i64 = 32767

functions

12func bd_u16(b: *u8, o: i64) -> i64 { return (b[o] as i64) | ((b[o+1] as i64)<<8) }
called by 1: bmp_decode_rgb
13func bd_u32(b: *u8, o: i64) -> i64 { return (b[o] as i64) | ((b[o+1] as i64)<<8) | ((b[o+2] as i64)<<16) | ((b[o+3] as i64)<<24) }
14func bd_s32(b: *u8, o: i64) -> i64 { var v: i64=bd_u32(b,o); if v>=K_MAGIC_2147483648 { v=v-K_MAGIC_4294967296 } return v }
called by 1: bmp_decode_rgb calls 1: bd_u32
16func bmp_decode_rgb(raw: *u8, n: i64, out_wh: *i64) -> *u8