Skip to main content

Crate k2f_paint

Crate k2f_paint 

Source

Structs§

FormFieldLoc
A fillable field joined with its lock box. Geometry comes from boxes_for; value comes from the semantic tree. Not a lock-file field.
LocatedBox
OpenedDocument
Opened .K2F: same inspect as CLI verify, paint the lock only. Never recompile.
PlacedGlyph
A glyph to draw at lock coordinates. Shared by PNG and PDF executors.
TextDecorationLine
Horizontal decoration stroke in document (y-down) points.
TextSpan
One selectable fragment on a painted page. Coordinates are points, not millipts.

Enums§

Banner
PaintError

Constants§

OFFICIAL_PNG_SCALE
Official pixel comparison uses this raster scale. Viewer CSS zoom is UI-only.
SVG_EXPORT_PX_PER_PT
Pixels per document point when an SVG is embedded in PDF, DOCX, PPTX, or IDML. Matches the viewer paint-scale cap so export hairlines sit in the same class as on-screen paint. Official PNG comparison stays at scale 2; that gate is not the export resolution.
SVG_RASTER_MAX_PX
Widest or tallest SVG raster we will allocate. A landscape page at the viewer cap (4 px/pt) stays under this; larger requests fail instead of exhausting WASM.

Functions§

baseline_y_pt
cover_src
Centered cover crop in source pixels: (sx, sy, sw, sh). The cropped region scaled to the box fills it without letterbox bars.
cover_src_rect_100000
DrawingML a:srcRect l/t/r/b in 1/1000 percent (0..=100000) for a cover crop.
decode_raster
decoration_lines
document_markdown
Full-document Markdown for human export (no k2f hint comments).
export_pages_jpeg
All lock pages as JPEG. Single-page docs return one JPG; multi-page return a zip.
export_pages_jpeg_official
export_pages_png
All lock pages as PNG. Single-page docs return one PNG; multi-page return a zip.
export_pages_png_official
face_for
face_style_is_bold
face_style_is_italic
face_subfamily
TTF subfamily (Bold, Italic, Regular, …). Same table IDML reads.
geo_for_op
Resolve the geometry fragment for a paint op. Prefers an exact rect match when multiple boxes share node_id (multi-column / fragmented text on one page).
geo_for_op_str
glyph_origin_pt
index_geometry_multi
Index all geometry boxes by semantic id (same id may appear multiple times on one page).
index_geometry_multi_str
letterbox_dest
Integer letterbox (contain, centered) of an image into a destination box. Returns (x, y, width, height) inside the box.
letterbox_rect
Same contain/center fit as letterbox_dest, in lock millipt space.
load_faces
lookup_image
parse_hex_rgba
pixmap_to_rgb8
Straight RGB888 from a premultiplied RGBA pixmap (white where alpha is zero).
pixmap_to_rgba8
Straight RGBA8888 from a premultiplied pixmap. Fully transparent pixels stay alpha 0 (they are not flattened onto white).
placed_glyphs
png_to_jpeg
Encode a PNG page raster as JPEG.
raster_for_embed
Decode for PDF embedding. SVG is rasterized at export density; PNG/JPEG/WebP stay at their file dimensions (rect is ignored for those).
render_lockfile_page_rgb
render_lockfile_page_rgba
Same paint as render_lockfile_page_rgb, cleared to transparent and returned as straight RGBA. Existing RGB callers stay on an opaque white clear.
render_lockfile_page_to_png
render_svg_uniform
Rasterize the whole SVG into dest_w×dest_h with one scale transform. Callers pass a size that preserves aspect (the contain letterbox). Does not nearest-neighbor upscale a smaller bitmap.
resolve_fill
single_font_map
spans_for_page
svg_export_raster_px
Pixel size of an SVG embedded in PDF / DOCX / PPTX / IDML.
svg_intrinsic_px
Viewport size in pixels: the SVG width/height rounded up, matching [decode_svg]. Fit math uses this so a scaled raster keeps the same aspect as the intrinsic decode.
svg_png_for_export
SVG → PNG at the export pixel size for rect and fit. Bitmaps do not use this.