Added
-
Stacklays children in layers (#1071).gui.Stack(cfg)takes a
ContainerCfgand puts its children one over the other. The first child is
the bottom layer and the last child is the top layer: it is drawn last and
gets the pointer first. Every child starts at the content origin. AFill
child takes the whole content box, and a Fit Stack is as large as its largest
child.HAlignandVAlignplace each child on both axes;Spacinghas no
effect. Before this, controls over a background image or canvas needed
Float, which takes the layer out of its container: it did not scroll or clip
with it and did not size it. Stack layers stay in the tree.examples/stack/
and the showcase's Stack page show it. -
PDF print keeps nearest-neighbor images sharp (#1069). An
Imagewidget
withFilter: gui.ImageFilterNearest, or a canvas image drawn after
SetImageFilter(gui.ImageFilterNearest), now prints with hard pixel edges.
Setting the PDF/Interpolateflag would not help: it is already off by
default, and most viewers smooth a scaled image anyway. So the export repeats
each source pixel enough times to reach 300 dpi at the drawn size, capped at
4096 pixels per side, and embeds that larger image. Mem images and PNG, JPEG
and GIF files are covered. A file that cannot be decoded is embedded as
before. Linear images are unchanged. The PDF file grows, though repeated
pixels compress well as PNG. -
ImageCfg.Filterdraws a scaledImagewidget with sharp pixels (#1066).
SetFilter: gui.ImageFilterNearestand the widget samples the nearest texel,
asDrawContext.SetImageFilterdoes on a canvas. A sprite or pixel-art icon
shown throughgui.Imageno longer turns blurred when it is drawn larger than
its own size. The zero value isImageFilterLinear, so existing images draw
as before. A remote SVG ignores the field.examples/pixel_art/now shows
both the canvas and the widget. -
DrawContext.SetImageFilterdraws scaled images with sharp pixels
(#1065).dc.SetImageFilter(gui.ImageFilterNearest)makes theImage,
ImageWithFetcherandImageClippedcalls that follow sample the nearest
texel instead of blending four. Pixel art, retro UIs and small sprites drawn
at 2x or more keep hard edges instead of turning blurred. The filter is part
of the stateSaveandRestorekeep, and eachOnDrawstarts with
ImageFilterLinear, so nothing changes for code that does not set it. All
backends support it: Metal (macOS, iOS), OpenGL (Linux, Windows), Android, web
and the software renderer. ADrawRecorder(SVG export) does not get it. The
Imagewidget gets the same option in #1066.examples/pixel_art/shows both
filters side by side. -
CanvasPath.TrimTodraws part of a path's length (#1023).
p.TrimTo(&dst, from, to)writes intodstthe part ofpbetween the
fractionsfromandtoof its length. Animatetofrom 0 to 1 and a stroke
draws itself in, asstroke-dasharrayanimation does in SVG: a check mark, a
progress ring along a custom outline. The length is the flattened length at
the stroke tolerance, over all subpaths together. Lines, curves and arcs are
cut exactly and stay what they were, so SVG and PDF export still get curves. A
closed subpath cut short comes back open, with end caps. Out-of-range values
clamp; NaN,from >= toor an empty path give an emptydst.dstkeeps its
buffers, so a trim redone every frame does not allocate.examples/path_trim/
shows it, and so does the showcase's Draw Canvas page. -
Android apps can provide secure secret storage (#930). The Android backend
accepts a narrow gomobileSecretStorecallback forLoadSecret,
SaveSecretandDeleteSecret. Android applications supply and register the
Kotlin implementation; the Android demo provides one backed by a
non-exportable 256-bit Android Keystore key and AES-GCM ciphertext stored
atomically innoBackupFilesDir. An app that does not register the callback
still receivesErrSecretsUnsupported. -
The Android AAR now includes x86_64 (#930). CI, the release workflow and
make build-androidbindandroid/arm64,android/amd64, so the released AAR
runs on an x86_64 emulator as well as on arm64 devices.
Changed
-
The showcase catalog adapts to narrow windows and phones (#1072). The
catalog used to be a fixed 300 px column at any width, so on a phone the page
beside it was squeezed to about 90 px. Below 780 px the page now takes the
full width under a top bar, and its ☰ button opens the catalog as a drawer
over a dimmed page. Picking an entry, tapping the dimmed strip, ☰ or Esc
closes it. On a wider window the catalog stays inline as before, and a ☰ in
its header slides it shut so a wide demo gets the whole window. -
Less work per frame for WebGL SVGs on the web (#1051). Each frame in WebGL
mode makes a first pass to place the SVG batches. That pass replayed every
clip, filter, rotation and transform into a JavaScript stand-in that did
nothing, only to learn where batches start and end. It now tracks that state
in Go and makes no call on the 2D context. On a page of rotated cells, the
pass's share of total CPU went from 16% to 10%. Nothing draws differently.
What's Changed
Other changes
- ci: treat #886 Windows runtime crashes as a warning, not a failure by @mike-ward in #1057
- perf(web): keep 2D state in Go during the WebGL SVG pre-pass (#1051) by @ollex in #1054
- build: port large-files and theme-surface-check to Go tools (#1026) by @mike-ward in #1058
- build: port coverage gate and diff to Go tool (#1026) by @mike-ward in #1059
- build: port run-parallel to Go tool (#1026) by @mike-ward in #1060
- build: port dev-loop to Go tool (#1026) by @mike-ward in #1061
- build: port gl-render-test to Go tool (#1026) by @mike-ward in #1062
- Add Android SecretStore host bridge by @ollex in #1063
- Add CanvasPath.TrimTo for draw-on path animation (#1023) by @mike-ward in #1064
- Add DrawContext.SetImageFilter for nearest-neighbor images (#1065) by @mike-ward in #1067
- Add ImageCfg.Filter for nearest-neighbor Image widgets (#1066) by @mike-ward in #1068
- Keep nearest-neighbor images sharp in PDF print (#1069) by @mike-ward in #1070
- Add Stack layout container (#1071) by @mike-ward in #1076
- Make the showcase catalog responsive (#1072) by @ollex in #1073
- Give devloop's binary the .exe suffix on Windows (#1074) by @ollex in #1075
- Run tools tests on the Windows job (#1077) by @mike-ward in #1078
- changelog: add v0.90.0 by @mike-ward in #1079
Full Changelog: v0.89.1...v0.90.0