Commit Graph
10 Commits
Author SHA1 Message Date
shaneandshinyobjectz 8627ba7ab4 Paint fixes: canvas drawImage, boxed 3D view culling, grey emoji (#260, #261, #262) (#268)
* Three paint fixes: a canvas draws a loaded Image, a boxed 3D view culls by its box, grey bitmap emoji draw (raea #260, #261, #262)

#260: drawImage of a loaded Image onto a canvas made in a composition drew nothing. The canvas is read back off the
page, where there is no project folder to find staticFile's /media/x in. A loaded Image now carries the file the host
found as currentSrc (sdk/raea frame-globals.ts), which drawImage already prefers, and the canvas host takes a src that
is a file as it stands whatever its roots make of it (systems/canvas media_file).

#261: two causes, neither the plane's turn. Bevy's update_frusta culls by the projection's whole view at the target's
shape, so a camera drawing a page box wider than the frame (an <R3F> in a 1080 x 389 box of a 1080 x 600 frame) had
meshes inside the box's view culled: the shelf's side cards, where the same cards turned the other way reached into
the frame's view and drew. raea-sys-viewbox's sub_view_frusta gives a camera with a sub view that view's frustum,
after Bevy's own and before visibility is checked. And `raea render X.tsx -o x.png` with no --frame took the frames
path, which draws 3D from rows under the whole frame and ignored the box; a 3D piece's bare .png is now drawn as
--frame 0 draws it.

#262: Apple Color Emoji keeps 52 glyphs (💬, 🗨) as grey + alpha PNGs. Vello's glyph run asks png for RGBA with a
transformation that leaves grey as it is, logs "Unsupported `output_color_type`" and skips the glyph. The page's
painter (raea-sys-filters) takes those glyphs out of the run and draws them as images placed as Vello places a
bitmap glyph (emoji.rs); skrifa and png at Vello's versions.

* The export crate stays within its 2000 lines: the still's frame-0 branch in four lines (the size gate failed #268 at 2004)

* The emoji decoder widens a PNG's pixels in one loop: its three one-line closures matched closures elsewhere, and the duplicate gate failed #268 by two exact groups and one near

* A .png with no --frame goes through the stills branch as frame 0: the export crate stays at its 1996 lines (with LX6 and LT1's planned four it is at the 2000 limit, and the tasks gate failed #268)

---------

Co-authored-by: shinyobjectz <[email protected]>
2026-11-29 11:49:23 -08:00
shaneandshinyobjectz 096f87d153 A canvas draws a picture from its file: drawImage of a /media/ src (raea #253) (#258)
#255 gave new Image() in a composition its size, so the issue's 3D cards got a canvas the right size, but drawing the
screenshot on it painted nothing: the canvas host decoded only data: URLs (systems/canvas draw.rs decode). A picture
that isn't inline is now read from its file, found by the same roots a canvas's videos are (the page host's
page_path, so /media/x is the project's file; a plain or file:// path without one), its type by its name (png, jpeg,
webp, gif, bmp, svg). A src that isn't there, or isn't a picture, still draws nothing.

Co-authored-by: shinyobjectz <[email protected]>
2026-11-27 13:23:57 -08:00
shinyobjectz 5189132ef8 LR10: a canvas's system-ui and BlinkMacSystemFont are macOS's SF ("System Font", variable in weight and optical size), as Chrome's canvas takes them. fontdb knew neither name, so a font list headed by them (snapcn's '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif') was measured and drawn in Helvetica, about 10% wider at 72px, and 600 measured as 700. -apple-system alone stays as it is: Chrome's canvas finds no face for it either. text-build, which places its words from measureText, goes from 9 px off Chrome to 1.3; the rest is SF's trak table, which CoreText applies and usvg doesn't 2026-11-12 20:30:01 -08:00
shinyobjectz 44ca3f16d6 LR10: a page's fonts as Chrome finds them, in svg and canvas text. An @font-face face is found by its own weight and style, not its file's (Google serves one variable Inter as every weight, whose file says 400, so 500 drew as 400 and 600 as raea's bundled 700); a face given twice (document.fonts.load and the page's @font-face) is added once; a page's faces of a family shadow the app's bundled ones, as @font-face shadows a local font (raea's static Inter 400 beside Google's 400 read to canvas text as a family split by unicode-range); and a character's advance is read at the weight asked for (a space's moves with a variable face). The canvas has letterSpacing and wordSpacing, shaped by the host. snapcn: title-sweep 3.7 -> 0.3, spec-sweep 4.4 -> 0.3, sky-lockup 15.7 -> 0.3; the corpus 12 of 33 (7 before LR10) 2026-11-12 20:30:01 -08:00
shinyobjectz 8a51aa0433 LR10: svg text spaces its last letter as Chrome does. usvg 0.48.1 left letter-spacing off a text chunk's last cluster, so an svg <text> with letter-spacing and a middle or end anchor was drawn half or a whole spacing off where Chrome draws it, and its box was a spacing short. vendor/usvg patches apply_letter_spacing (marked raea:), canvas.svgText's length drops the tracking it added to make up for it, and the layout-reads box reader skips an svg's <title> and <desc>, which are never drawn. snapcn: drop-line 1.3 -> 0.2 and hello-zoom pass; P26 unchanged (the six fixtures under the bar fail the same frames at the same SSIM on a binary without the patch) 2026-11-12 20:30:01 -08:00
shinyobjectz ebff73dbc6 LR6, LR7: the canvas's text natives (measure, advances, svgText) are each a function of the fonts (raea_sys_canvas::TextNative), registered from one table and given the page's fonts by with_page_fonts, instead of three wrappers that did it alike; canvas.read's rectangle and svgText's tracking read without closures that copied raea-runtime-sound's (dupes back to 293/59)
Skills: SKILL.md's 7. Deliver (sources: runtime/export/src) checked, still true: the export's change only passes page.layout's request through.
2026-11-12 16:26:53 -08:00
shinyobjectz a5d89e95c1 LR7: a composition's document, with LR5's style and LR8's observers. LR5: el.style reads and writes the element's style (writes send an update op; React's next commit to the property wins), and getComputedStyle answers from the page's computed style: page.layout takes { styles: [ids] } and the snapshot carries s: {id: {property: value}} for them, as stylo serializes it (engine/page read.rs computed_style), kept until the next commit (page-layout.ts computedOf). LR7: document has body (the composition's surface, the element the page draws from), documentElement, getElementById, querySelector(All), createElement (appended into the composition it's laid out and measurable, removed it's gone; a canvas is an OffscreenCanvas), createTextNode and createRange: a Range over a text node is its characters laid out in the parent's computed font, placed where the parent's line starts. An svg <text> has getComputedTextLength, getNumberOfChars, getStartPositionOfChar, getEndPositionOfChar and getSubStringLength, laid out by usvg in the element's computed font (canvas.svgText: family, size, weight, letter- and word-spacing, font-variation-settings). document.fonts loads a family the composition asked for (fonts.load), and a FontFace given by URL is fetched through raea's cache into the faces an svg's and a canvas's text are set in (fonts.face). window is globalThis with innerWidth, innerHeight, devicePixelRatio and getComputedStyle. LR8: ResizeObserver calls back after a commit whose layout changed an observed element's size, and once on observe, with contentRect, borderBoxSize and contentBoxSize; while a delayRender hold is open it checks every 16 ms, as a browser renders while a page waits. MutationObserver and IntersectionObserver exist and never call back. A pass that draws no page (the sound pass, the 3D rows' pre-pass) answers reads with a 0 x 0 page, and its holds are released (page-layout.ts noPage): a hold waiting on a measure could never end there. probes/document.tsx and probes/observe.tsx match Chrome within 1 px 2026-11-12 16:16:09 -08:00
shinyobjectz 34629d33b8 LR6: a composition's 2D context measures and reads back. measureText is the text shaped by usvg as the canvas draws it, in the page's fonts (canvas.measure: width, actualBoundingBox*, fontBoundingBox*, from the alignment point), and getImageData reads back what was drawn (canvas.read); raea-runtime-canvas serves both as natives, which @raea/ui's wire reaches through the composition's __ui_sync (sdk/raea canvas2d.ts). putImageData writes its pixels as they are (a put op). OffscreenCanvas is a canvas no page shows. raea's bundled faces (Inter and the rest) now reach usvg's font database too, so a canvas measures and draws them, not a fallback. probes/measure.tsx matches Chrome: width exact, ink and font box within 0.8 px, pixels read back equal 2026-11-12 16:02:32 -08:00
shinyobjectz 1dff4f0aa8 raea e699cf684509a8bbada118cc302c56e99065a680 2026-11-05 17:19:37 -08:00
shinyobjectz f675b0ad2b raea dc579e418 2026-10-31 13:15:29 -07:00