nx_bmp_decode.nx
buildroot/runtime/nx_bmp_decode.nx
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
imports: nx_syscalls.nx
imported by: nx_bmp_tiff_gate.nxnx_img_bytes_to_rgb.nx
structs
| none |
consts
| 8 | const K_MAGIC_2147483648: i64 = 2147483648 |
| 9 | const K_MAGIC_4294967296: i64 = 4294967296 |
| 10 | const K_MAGIC_32767: i64 = 32767 |
functions
| 12 | func bd_u16(b: *u8, o: i64) -> i64 { return (b[o] as i64) | ((b[o+1] as i64)<<8) } called by 1: bmp_decode_rgb |
| 13 | func 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) } |
| 14 | func 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 } |
| 16 | func bmp_decode_rgb(raw: *u8, n: i64, out_wh: *i64) -> *u8 |