code wiki / (root) / nx_paint_fb_ascii_dump.nx

nx_paint_fb_ascii_dump.nx

buildroot/runtime/nx_paint_fb_ascii_dump.nx

3529 B88 linesdepth 4pulls 4 transitivereach 83 importersview sourcekind librarytopic paint
docsdependenciesstructsconstsfunctions

about

nx_paint_fb_ascii_dump.nx -- dump a Framebuffer to ASCII-art bytes in a caller-supplied output buffer. Phase 5 first primitive of NISHI_BROWSER_ROADMAP. Lets the bits-up substrate produce VISIBLE output we can read in a terminal -- closes the demo gap. Char selection (5-level luminance bucket per pixel): alpha == 0 -> ' ' (transparent) luminance 0..63 (with alpha) -> '.' luminance 64..127 -> '+' luminance 128..191 -> 'o' luminance 192..255 -> '#' Luminance computed as a simple sum of the three channels divided by 3 (close-enough for ASCII art; not the perceptual Rec.601 weights). Integer-only; no FP. Output layout: WIDTH chars per row followed by '\n', repeated for every row. Total output bytes = (width + 1) * height. What it does NOT handle yet (Phase 5b queued, explicit in header): - Unicode block characters (▀ ▄ █ ░ ▒ ▓) for richer 2:1 ratio - ANSI color escape codes for true-color terminals - Multi-pixel-per-cell averaging (Phase 5b "half-block" mode gets twice the vertical resolution by using ▀ + bg/fg color) - Perceptual Rec.601 luminance weights (0.299, 0.587, 0.114) Per cardinal feedback-honest-perf-verdict-no-aspirational-claims: gap list is EXACT in header. genealogy_id: classical_ascii_art_dither + nishi_substrate_phase_5 lineage_id: nishi_browser_fb_ascii_dump_v1

dependencies 2 imports · 13 importers

nx_syscalls.nx nx_paint_solid_rect.nx nx_paint_fb_ascii_dump.nx nx_browser_demo_42.nx nx_browser_demo_hello.nx nx_browser_demo_html.nx nx_browser_demo_html_nishi.nx nx_browser_demo_lowercase.nx nx_browser_demo_multiline.nx nx_browser_demo_pangram.nx nx_browser_demo_styled.nx nx_browser_render_own_test.nx nx_jpeg_ascii.nx

diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.

imports: nx_syscalls.nxnx_paint_solid_rect.nx

imported by: nx_browser_demo_42.nxnx_browser_demo_hello.nxnx_browser_demo_html.nxnx_browser_demo_html_nishi.nxnx_browser_demo_lowercase.nxnx_browser_demo_multiline.nxnx_browser_demo_pangram.nxnx_browser_demo_styled.nxnx_browser_render_own_test.nxnx_jpeg_ascii.nxnx_jpeg_ascii_test.nxnx_paint_fb_ascii_dump_test.nxnx_render_ascii.nx

structs

none

consts

none

functions

39func _fb_ascii_char_for_pixel(r: i64, g: i64, b: i64, a: i64) -> i64
53func nx_paint_fb_ascii_dump(fb: *Framebuffer,
81func nx_paint_fb_ascii_write(fb: *Framebuffer) -> i64