code wiki / _hdl_build / nx_render_html.nx

nx_render_html.nx

buildroot/runtime/_hdl_build/nx_render_html.nx

38214 B730 linesdepth 7pulls 27 transitivereach 77 importersview sourcekind librarytopic render
docsdependenciesstructsconstsfunctions

about

nx_render_html.nx -- REUSABLE: render an HTML byte buffer to a styled 24-bit BMP. The full styled pipeline (extracted from nx_render_wiki_styled so the file-driver AND nx_browse compose it, not duplicate it): combined [HTML][UA-CSS] buffer -> nx_layout_from_dom -> box-indexed CssElement[] -> nx_css_apply -> font-size/spacing-aware layout -> HTML-entity decode -> inherited-color + font-size-scaled paint -> 24-bit BMP. UA sheet = heading bars + box-model spacing + blue links + font-size hierarchy. 100% sovereign (no gcc/V8/Chrome). This organ has NO main (it's a library).

dependencies 19 imports · 42 importers

nx_syscalls.nx nx_css_vars.nx nx_css_tokenize.nx nx_css_parse.nx nx_css_apply.nx nx_css_color_decode.nx nx_css_selector_match.nx nx_html_tokenizer.nx nx_html_entities.nx nx_dom_query.nx nx_render_html.nx nx_align_gate.nx nx_bg_shorthand_gate.nx nx_border_gate.nx nx_border_probe.nx nx_browse.nx nx_browser.nx nx_browser_render.nx nx_cdata_gate.nx nx_cdata_probe.nx nx_chrome_drop_gate.nx

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

imports: nx_syscalls.nxnx_css_vars.nxnx_css_tokenize.nxnx_css_parse.nxnx_css_apply.nxnx_css_color_decode.nxnx_css_selector_match.nxnx_html_tokenizer.nxnx_html_entities.nxnx_dom_query.nxnx_layout_box.nxnx_layout_default_display.nxnx_layout_from_dom.nxnx_layout_block.nxnx_paint_solid_rect.nxnx_paint_text.nxnx_font_bitmap_5x7.nxnx_paint_walk_layout.nxnx_png_write.nx

imported by: nx_align_gate.nxnx_bg_shorthand_gate.nxnx_border_gate.nxnx_border_probe.nxnx_browse.nxnx_browser.nxnx_browser_render.nxnx_cdata_gate.nxnx_cdata_probe.nxnx_chrome_drop_gate.nxnx_css_vars_engine_gate.nxnx_fg007_probe.nxnx_flexgrow_gate.nxnx_flexgrow_probe.nxnx_float_gate.nxnx_float_inline_gate.nxnx_float_test.nxnx_grid_app_demo.nxnx_grid_demo.nxnx_grid_gate.nxnx_grid_test.nxnx_grid_track_gate.nxnx_inline_gate.nxnx_inline_hidden_gate.nxnx_justify_demo.nxnx_justify_gate.nxnx_layout_debug.nxnx_named_color_gate.nxnx_negmargin_gate.nxnx_real_page_gate.nxnx_reftest_gate.nxnx_render_page_gate.nxnx_render_page_probe.nxnx_render_wiki_styled.nxnx_rgb_color_gate.nxnx_specificity_gate.nxnx_table_cell_gate.nxnx_wiki_boxdump.nxnx_wpt_dim_probe.nxnx_wpt_run.nxnx_wpt_run_gate.nxnx_wrap_gate.nx

structs

none

consts

26const K_MAGIC_4096: i64 = 4096
27const K_MAGIC_1000000: i64 = 1000000
28const K_MAGIC_262144: i64 = 262144
29const K_MAGIC_16384: i64 = 16384
30const K_MAGIC_8192: i64 = 8192
31const K_MAGIC_32768: i64 = 32768
32const K_MAGIC_5000: i64 = 5000

functions

34func rh_slen(s: *u8) -> i64 { var k: i64=0; while s[k]!=(0 as u8){k=k+1} return k }
called by 1: _rh_to_fb
35func rh_u32(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(4); b[0]=(v&255) as u8; b[1]=((v>>8)&255) as u8; b[2]=((v>>16)&255) as u8; b[3]=((v>>24)&255) as u8; sys_write(fd,b,4); return 0 }
called by 1: rh_save calls 2: sys_mmapsys_write
36func rh_u16(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(2); b[0]=(v&255) as u8; b[1]=((v>>8)&255) as u8; sys_write(fd,b,2); return 0 }
called by 1: rh_save calls 2: sys_mmapsys_write
37func rh_save(path: *u8, fb: *Framebuffer, w: i64, y0: i64, y1: i64) -> i64
60func rh_extract(html: *u8, hlen: i64, elements: *CssElement, maxn: i64) -> i64
93func rh_is_elem(k: i64) -> i64 { if k==NX_LAYOUT_BOX_BLOCK {return 1} if k==NX_LAYOUT_BOX_INLINE {return 1} if k==NX_LAYOUT_BOX_INLINE_BLOCK {return 1} return 0 }
94func rh_digit(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } return 0 }
called by 1: rh_num_after
96func rh_find(src: *u8, off: i64, end: i64, pat: *u8) -> i64
111func rh_num_after(src: *u8, p: i64, end: i64) -> i64
called by 1: rh_media_matches calls 1: rh_digit
122func rh_media_matches(src: *u8, off: i64, end: i64, vw: i64) -> i64
called by 1: rh_filter_media calls 2: rh_findrh_num_after
136func rh_filter_media(src: *u8, off: i64, len: i64, out: *u8, out_cap: i64, vw: i64) -> i64
186func _rh_copy_css(html: *u8, off: i64, len: i64, out: *u8, op: *i64, cap: i64) -> i64
called by 1: rh_extract_styles
207func rh_extract_styles(html: *u8, hlen: i64, out: *u8, out_cap: i64) -> i64
236func _rh_namechar(c: i64) -> i64
245func _rh_name_end(buf: *u8, s: i64, end: i64) -> i64
called by 1: _rh_match_compound calls 1: _rh_namechar
253func _rh_match_compound(buf: *u8, off: i64, len: i64, el: *CssElement) -> i64
288func _rh_match_one(buf: *u8, off: i64, len: i64, box_idx: i64, tree: *LayoutTree, boxel: *CssElement, coff: *i64, clen: *i64, ccmb: *i64) -> i64
called by 1: rh_match_complex calls 1: _rh_match_compound
348func rh_match_complex(buf: *u8, off: i64, len: i64, box_idx: i64, tree: *LayoutTree, boxel: *CssElement, coff: *i64, clen: *i64, ccmb: *i64) -> i64
called by 1: rh_cascade calls 1: _rh_match_one
366func rh_namechar2(c: i64) -> i64
called by 1: rh_specificity
378func rh_specificity(buf: *u8, off: i64, len: i64) -> i64
called by 1: rh_cascade calls 1: rh_namechar2
423func rh_promote_display_kinds(tree: *LayoutTree, computed: *CssComputedDecl, ncomp: i64, src: *u8) -> i64
470func rh_cascade(buf: *u8, rules: *CssRule, n_rules: i64, decls: *CssDeclaration, n_decls: i64,
545func _rh_to_fb(raw: *u8, hlen: i64, out3: *i64) -> *Framebuffer
693func rh_save_png(path: *u8, fb: *Framebuffer, w: i64, y0: i64, y1: i64) -> i64
715func nx_render_html_to_bmp(raw: *u8, hlen: i64, bmp_path: *u8) -> i64
724func nx_render_html_to_png(raw: *u8, hlen: i64, png_path: *u8) -> i64