nx_mailpiece.nx
buildroot/runtime/nx_mailpiece.nx
about
nx_mailpiece.nx -- PHYSICAL MAIL COMPOSITION (rung 2 of Nishi Mail to SOTA). Composes a print-ready
postcard as an RGB raster and writes it as PNG (preview + the exact bitmap the sovereign print path
nx_img_print -> PWG/URF -> IPP feeds to a real printer). NISHI-POSTCARD: 6x4in @300dpi = 1800x1200.
FRONT = greeting design (accent bleed + cream panel + centered title). BACK = USPS layout: message on
the left, a vertical divider, the recipient address block in the address zone on the right, a stamp
(indicia) box top-right, and the lower-right IMb barcode clear zone kept blank by construction.
Sovereign: pure integer raster ops + the sovereign 8x8 font; no 3rd party. Last-mile (print vs carrier)
is the next rung. Commands: postcard <front.png> <back.png> <greeting> <message> <recipient> <line1> <city> <region> <postal> ; argless = selftest.
expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_font8x8.nxnx_png_write.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 13 | const K_MAGIC_1800: i64 = 1800 |
| 14 | const K_MAGIC_1200: i64 = 1200 |
| 15 | const K_MAGIC_1080: i64 = 1080 |
| 16 | const K_MAGIC_1040: i64 = 1040 |
| 17 | const K_MAGIC_1560: i64 = 1560 |
| 18 | const K_MAGIC_1720: i64 = 1720 |
| 19 | const K_MAGIC_1587: i64 = 1587 |
| 20 | const K_MAGIC_2550: i64 = 2550 |
| 21 | const K_MAGIC_3300: i64 = 3300 |
| 22 | const K_MAGIC_1099: i64 = 1099 |
| 23 | const K_MAGIC_1102: i64 = 1102 |
| 24 | const K_MAGIC_2199: i64 = 2199 |
| 25 | const K_MAGIC_2202: i64 = 2202 |
| 26 | const K_MAGIC_1250: i64 = 1250 |
| 27 | const K_MAGIC_1380: i64 = 1380 |
| 28 | const K_MAGIC_1950: i64 = 1950 |
| 29 | const K_MAGIC_2500: i64 = 2500 |
| 30 | const K_MAGIC_2590: i64 = 2590 |
| 31 | const K_MAGIC_3140: i64 = 3140 |
| 32 | const K_MAGIC_2850: i64 = 2850 |
| 33 | const K_MAGIC_1238: i64 = 1238 |
| 34 | const K_MAGIC_2620: i64 = 2620 |
| 35 | const K_MAGIC_2760: i64 = 2760 |
| 36 | const K_MAGIC_2640: i64 = 2640 |
| 37 | const K_MAGIC_1612: i64 = 1612 |
| 38 | const K_MAGIC_1088: i64 = 1088 |
| 39 | const K_MAGIC_3150: i64 = 3150 |
| 40 | const K_MAGIC_2175: i64 = 2175 |
| 41 | const K_MAGIC_1575: i64 = 1575 |
| 42 | const K_MAGIC_2050: i64 = 2050 |
| 43 | const K_MAGIC_1300: i64 = 1300 |
| 44 | const K_MAGIC_1890: i64 = 1890 |
functions
| 46 | func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 47 | func p(s: *u8) -> i64 { sys_write(1, s, slen(s)); return 0 } called by 7: pncomposecompose_lettercompose_envelopecompose_cardcmd_selftest+1 calls 2: sys_writeslen |
| 48 | func pn(v: i64) -> i64 |
| 54 | func seq(a: *u8, b: *u8) -> i64 called by 1: main |
| 62 | func set_px(rgb: *u8, W: i64, H: i64, x: i64, y: i64, r: i64, g: i64, b: i64) -> i64 |
| 71 | func fill_rect(rgb: *u8, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64, r: i64, g: i64, b: i64) -> i64 |
| 76 | func rect_outline(rgb: *u8, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64, th: i64, r: i64, g: i64, b: i64) -> i64 |
| 84 | func draw_glyph(rgb: *u8, W: i64, H: i64, tbl: *u8, ch: i64, x: i64, y: i64, sc: i64, r: i64, g: i64, b: i64) -> i64 |
| 104 | func draw_text(rgb: *u8, W: i64, H: i64, tbl: *u8, s: *u8, x: i64, y: i64, sc: i64, sp: i64, r: i64, g: i64, b: i64) -> i64 |
| 111 | func draw_wrap(rgb: *u8, W: i64, H: i64, tbl: *u8, s: *u8, x: i64, y: i64, sc: i64, maxw: i64, r: i64, g: i64, b: i64) -> i64 |
| 130 | func cpy(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } |
| 131 | func text_w(s: *u8, sc: i64, sp: i64) -> i64 { return slen(s) * (8*sc + sp) } |
| 132 | func fsize(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let n: i64 = sys_lseek(fd, 0, 2); sys_close(fd); return n } |
| 135 | func compose(fp: *u8, bp: *u8, greeting: *u8, message: *u8, recipient: *u8, line1: *u8, city: *u8, region: *u8, postal: *u8) -> i64 |
| 182 | func compose_letter(a: *i64) -> i64 |
| 219 | func compose_envelope(a: *i64) -> i64 called by 2: cmd_selftestmain calls 7: font8x8_tablesys_mmapfill_rectdraw_textrect_outlinenx_png_write_rgb+1 |
| 242 | func compose_card(a: *i64) -> i64 |
| 278 | func cmd_selftest() -> i64 |
| 334 | func main(argc: i64, argv: *i64) -> i64 |