github go-gui-org/go-gui v0.90.0

latest releases: v0.101.0, v0.100.1, v0.100.0...
one month ago

Added

  • Stack lays children in layers (#1071). gui.Stack(cfg) takes a
    ContainerCfg and 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. A Fill
    child takes the whole content box, and a Fit Stack is as large as its largest
    child. HAlign and VAlign place each child on both axes; Spacing has 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 Image widget
    with Filter: gui.ImageFilterNearest, or a canvas image drawn after
    SetImageFilter(gui.ImageFilterNearest), now prints with hard pixel edges.
    Setting the PDF /Interpolate flag 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.Filter draws a scaled Image widget with sharp pixels (#1066).
    Set Filter: gui.ImageFilterNearest and the widget samples the nearest texel,
    as DrawContext.SetImageFilter does on a canvas. A sprite or pixel-art icon
    shown through gui.Image no longer turns blurred when it is drawn larger than
    its own size. The zero value is ImageFilterLinear, so existing images draw
    as before. A remote SVG ignores the field. examples/pixel_art/ now shows
    both the canvas and the widget.

  • DrawContext.SetImageFilter draws scaled images with sharp pixels
    (#1065).
    dc.SetImageFilter(gui.ImageFilterNearest) makes the Image,
    ImageWithFetcher and ImageClipped calls 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 state Save and Restore keep, and each OnDraw starts 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. A DrawRecorder (SVG export) does not get it. The
    Image widget gets the same option in #1066. examples/pixel_art/ shows both
    filters side by side.

  • CanvasPath.TrimTo draws part of a path's length (#1023).
    p.TrimTo(&dst, from, to) writes into dst the part of p between the
    fractions from and to of its length. Animate to from 0 to 1 and a stroke
    draws itself in, as stroke-dasharray animation 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 >= to or an empty path give an empty dst. dst keeps 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 gomobile SecretStore callback for LoadSecret,
    SaveSecret and DeleteSecret. 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 in noBackupFilesDir. An app that does not register the callback
    still receives ErrSecretsUnsupported.

  • The Android AAR now includes x86_64 (#930). CI, the release workflow and
    make build-android bind android/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

Full Changelog: v0.89.1...v0.90.0

Don't miss a new go-gui release

NewReleases is sending notifications on new releases.