nx_urf.nx
buildroot/runtime/nx_urf.nx
about
nx_urf.nx -- sovereign URF (Apple Raster / UNIRAST) document encoder. Wraps the shared PWG RLE in the
URF container the Brother (and every AirPrint printer) accepts (document-format image/urf).
URF layout (reverse-engineered + cross-checked; the Brother advertises urf-supported=W8 = 8-bit gray):
FILE HEADER (12 bytes): "UNIRAST\0" (8) + uint32 BE page-count.
PER-PAGE HEADER (32 bytes):
[0] bitsPerPixel (8 for sgray_8) [1] colorspace (sGray=0,sRGB=1) [2] duplex (0/1/2)
[3] quality (0 def,3 draft,4 normal,5 high) [4] mediaType (0 auto) [5] mediaPosition (0 auto)
[6..11] reserved(0) [12..15] width BE [16..19] height BE [20..23] dpi BE [24..31] reserved(0)
PAGE DATA: PWG/URF PackBits RLE (nx_pwg_rle), pixels top-to-bottom, left-to-right.
HONEST NOTE: the RLE is spec-PROVEN (CUPS spec worked example); the URF header is spec-GROUNDED
(reverse-engineered) -- the real printer is the final oracle (live submit = the next rung).
NEVER-BRICK (#26): pure builder; no syscalls. Sovereign (imports only nx_pwg_rle.nx).
genealogy_id: project-printer-management-ipp-sclass-2026-06-20 ; license_tier: ORIGINAL
dependencies 1 imports · 7 importers
imports: nx_pwg_rle.nx
imported by: nx_doc_print.nxnx_doc_to_urf.nxnx_doc_to_urf_test.nxnx_img_print.nxnx_ipp_submit_test.nxnx_urf_make.nxnx_urf_test.nx
structs
| none |
consts
| 19 | const NX_URF_CS_SGRAY: i64 = 0 |
| 20 | const NX_URF_CS_SRGB: i64 = 1 |
| 21 | const NX_URF_DUP_NONE: i64 = 0 |
| 22 | const NX_URF_DUP_SHORT: i64 = 1 |
| 23 | const NX_URF_DUP_LONG: i64 = 2 // long-edge duplex -- the paper-waste fix |
| 24 | const NX_URF_Q_DEFAULT: i64 = 0 |
| 25 | const NX_URF_Q_DRAFT: i64 = 3 // draft = the toner-saving mode |
| 26 | const NX_URF_Q_NORMAL: i64 = 4 |
| 27 | const NX_URF_Q_HIGH: i64 = 5 |
functions
| 29 | func nx_urf_be32(out: *u8, off: i64, v: i64) -> i64 |
| 38 | func nx_urf_file_header(out: *u8, pages: i64) -> i64 |
| 52 | func nx_urf_page_header(out: *u8, off: i64, bpp: i64, colorspace: i64, duplex: i64, |
| 73 | func nx_urf_encode_gray_page(out: *u8, bitmap: *u8, width: i64, height: i64, |