Commit Graph
7 Commits
Author SHA1 Message Date
waozi 5da8134ad0 Consolidate Kry language documentation 2026-08-19 18:31:28 -03:00
waozi a585f1ced5 Implement Canvas WebAudio backend 2026-08-19 16:35:44 -03:00
waozi e0c588cd23 Add Linux desktop integration helpers 2026-08-19 15:47:56 -03:00
waozi f3dc8a6f3e canvas: real rounded rects, annulus rings, full tint, clipboard mirror
Rounded rectangles draw through ctx.roundRect with an arcTo fallback
(radius from raylib's roundness semantics), rings become true filled
annulus segments (outer arc forward, inner arc back, even-odd fill),
and vertical gradients now carry both full colors instead of reusing
the top RGB for the bottom stop.

Texture tinting is a real multiply: cached per (texture, tint) canvases
do multiply + destination-in, so RGBA tints on glyph atlases and render
targets composite exactly — pixel-verified in a real browser, where the
tinted sample read back the precise multiplied color.

The clipboard keeps a mirror of the last text the app wrote and attempts
the async browser write fire-and-forget: copy/paste round-trips within
the app; cross-app paste stays behind the sync API.

The node gate now asserts roundRect, the annulus arcs, and the
dual-stop gradient alongside the existing sequence.
2026-08-18 17:47:47 -03:00
waozi dc86744139 k2g: reach Go parity on the Runtime surface
The Runtime interface now covers every widget family go/kryui itself
exposes, not just the .kry whitelist: the positional controls
(GenericButton, TextButton, LocaleDropdown, VerticalSlider, CanvasGrid,
SelectableText, ShowUIToast(For)), the Props widgets (TextInputControl,
ReadonlyTextBox, TextArea, Radio, Spinbox, Combobox, LabelFrame,
Notebook, PanedView, Collapsible, ListBox, SourceView, TableView), the
dialogs, the canvas (BeginUICanvas/EndUICanvas), the Tk layout helpers
(BeginUIFrameBox, UIFramePack, UIGridCell, UIPlace), and theme control
(SetCurrentTheme/SetThemeDarkMode/SetThemeStyle with THEME_STYLE_*
constants under their C names).

k2g lowers .kry array declarations to Go slices at the use site
(state and local 'name: [N] const char*' references emit 'name[:]'),
accepts UICanvas literals like Props/Spec, and maps the canvas/Tk
handle types. The syntax gate now exercises the whole parity set and
still compiles the output against the real cgo runtime.

Honest remainder, noted in the matrix: DropdownEx's rich option
arrays, forward-goto-over-declarations, and C pointer/Texture2D
values stay outside what .kry can express.
2026-08-18 17:06:20 -03:00
waozi 4669ffb1b3 canvas: implement the HTML5 Canvas2D Tier A backend
src/backend/canvas_backend.c now exists: the full required surface
against a 2d canvas context through EM_JS. Draws are canvas paths,
textures are offscreen canvases (putImageData/drawImage stay
synchronous), text is glyph atlases rasterized from FontFace data
(EM_ASYNC_JS awaits face loading), input flows through the
KryonBackendRaw_* hooks fed by JS listeners, and the shared front-ends
(kry_instance, kry_screenshot, kry_input) are honored via the
KryonRaylibBackend_* seam names. Images decode through kryon's own
kry_sw PNG decoder; no raylib anywhere in the link.

The app while-loop survives the browser via -sASYNCIFY with a frame-end
yield. make canvas-test builds a complete app with this backend under
emcc and verifies the draw-call sequence in node against a recording
Canvas2D shim (glyph rasterize, atlas upload, and per-glyph drawImage
included); it skips cleanly where emcc is absent.

Approximations documented in BACKENDS.md: square rounded rects,
mid-radius ring strokes, no clipboard bridge, alpha-only tint.
2026-08-18 17:06:20 -03:00
waozi 78e9c369ca docs: k2c column, bare widget names, and a permanent HTML renderer
The widget matrix gains an explicit k2c column (always equal to C —
.kry reaches the whole API through plain call statements; the note was
prose-only before) and drops every DrawUI*-prefixed spelling in favor
of the bare widget names.

go/kryui now aliases the remaining prefixed calls (TextInputControl,
GenericButton, TextButton, ReadonlyTextBox, Dropdown(DropdownEx,
LocaleDropdown), VerticalSlider, Checkbox, ToggleSwitch, Hyperlink,
IconBtn) so the bare surface is complete; the C-mirroring spellings
stay as the definitions for existing callers.

scripts/feature-matrix-html.py renders the browsable color-coded view
(regenerate after every matrix change); the current HTML is committed
alongside.
2026-08-18 16:55:59 -03:00