Skip to content

v0.35.0

Latest

Choose a tag to compare

@github-actions github-actions released this 02 Nov 04:35
f7a6252

What changed and why

0.35.0 changes the display control's "clear graphics" button into a temporary hide toggle, and adds a way to save what the display
shows at the image's native resolution — from the context menu, and from code through a new public method. Both UI packages
(CvInspect.Wpf and CvInspect.Avalonia) get the same names and the same behavior.

Take this release if you want operators to look at the bare image for a moment without losing the result, or want to keep images
with the judgment graphics drawn on them (for example NG images) at full resolution.

Upgrading from 0.34.0:

  • Raise all your CvInspect packages together (lockstep). No code change is needed, with two exceptions that only matter if they apply:
    • The toolbar button is now a toggle button (UI Automation Toggle pattern instead of Invoke) named Hide Graphics. Its tooltip was
      Clear; its accessible name was Clear in Avalonia and the 🧹 content in WPF. Automation or tests that find or invoke it must be
      updated.
    • Avalonia: CvDispFileOp gained SaveWithGraphics. An ImageFileFailed handler that switches over every value needs one more case.
    • Menu labels: the cv:ClearGraphics key is gone and cv:HideGraphics / cv:SaveImageWithGraphics are new. Hosts that supply their
      own translations (CvLoc.Resolver or site-edited cv.*.json files) should add them; otherwise the built-in en/ko text is used.
  • CvInspect.Imaging and CvInspect.Imaging.Gev have no code change — only the version moves with the others.

Changed

Wpf and Avalonia — 🧹 "Clear Graphics" becomes 👁 "Hide Graphics", a temporary toggle

Before, the button erased the drawn result overlay until a new Overlay value was assigned — a new Frame alone did not restore it,
and re-assigning the same overlay object left it erased. Now:

  • Pressing it hides the whole result overlay, the summary HUD included. Teaching shapes (Shapes) and the image stay. Pressing it
    again shows the graphics.
  • It is temporary on purpose: while hidden, a new Frame or Overlay value shows the graphics again by itself, so an operator
    cannot forget a hidden overlay and miss an NG mark. During live inspection it therefore releases on the next frame — it is meant for a
    stopped image or a single result. Assigning the same object again is not a new value and does not release it; a Shapes change does
    not either. Hiding the toolbar (IsToolbarVisible = false) releases it, because the toggle and its menu entry go away with the toolbar.
    The hidden state is not a public property — hosts neither set nor read it.
  • The context-menu entry becomes a check item, "Hide Graphics", kept in step with the toolbar toggle. Clicking it sets the opposite of
    the check it showed when the menu opened. The Pan entry now follows the same rule in both packages (before, WPF copied the entry's
    check and Avalonia flipped the current ✋, which differed when host code changed ✋ while the menu was open).
  • The icon is a vector eye, the same in both packages, colored by the toolbar icon rules of 0.34 (ToolbarForeground). CvInspect gives
    the pressed 👁 no accent, since it is not a mode like Pan: Avalonia draws it on the toolbar icon color at 25% opacity, and WPF keeps the
    button style's own checked look.

Added

Wpf and Avalonia — context menu "Save Image (with Graphics)"

Right below "Save Image". It redraws the current frame at its native resolution with the result overlay (HUD included) on top and
writes it — not a screen capture, so zoom and pan do not matter.

  • Text and line widths keep the proportion they have when the image is fitted (with the 0.97 fit margin) to a 1280×960 view:
    k = max(1, 1 / fit scale). A 2448×2048 frame draws them about 2.2× their on-screen size in pixels; frames up to about 1241×931 draw
    them 1:1. OverlayLabelScale applies as on screen.
  • Teaching shapes, the image-area background and the no-image text are left out, and ClipOverlayToImage is not applied (graphics
    outside the image are cut at the bitmap edge). Graphics are included even while they are hidden on
    screen. Image pixels are the source pixels; a 4-channel frame is drawn opaque, so its B, G, R come out unchanged whatever its alpha.
  • File types, default name and error reporting are those of "Save Image" (WPF message box; Avalonia ImageFileFailed with
    CvDispFileOp.SaveWithGraphics, plus a log warning). Bytes are encoded in memory, so non-ASCII paths are safe.

Wpf and Avalonia — Mat? CvDispCtrl.RenderWithOverlay()

The same picture as the menu item, as a BGR 8-bit 3-channel Mat of the frame's size; null when no frame is displayed (including a
frame of an unsupported type).

  • Call it on the UI thread; another thread gets InvalidOperationException. No window is needed (Avalonia still needs its platform
    initialized).
  • The caller owns the returned Mat and disposes it. It is a snapshot of the frame and overlay at the call.
  • Typical use: keep an NG image with its judgment graphics at full resolution, without the menu.

Version

Minor: 0.35.0. Public API was added (RenderWithOverlay in both UI packages, CvDispFileOp.SaveWithGraphics in CvInspect.Avalonia)
and a toolbar button changed behavior.

Checks

  • dotnet build CvInspect.sln -c Release --no-incremental reports 0 warnings (an incremental build reports none when it recompiles nothing)
  • main is an ancestor of this branch (the release-pr-guard job verifies it)
  • the tag will be created on the merge commit, main merged back into dev afterwards, and dev bumped to the next -dev version
  • after publish, all five ids show 0.35.0 at https://api.nuget.org/v3-flatcontainer/<id>/index.json before consumers are told
Run Commit Result
CI run 41386711913 828fc97 Windows warnings 0; core 244/244, Wpf 81/81, Avalonia 86/86; Linux core 244/244, Avalonia 86/86
CI run 41388692461 8d70751 (release head) core 244/244, Wpf 81/81, Avalonia 86/86; Linux core 244/244, Avalonia 86/86

The release commit 8d70751 changes only <Version>.

Each new behavior is pinned by a regression test that was seen to fail with the behavior broken on purpose (toggle hiding incl. HUD,
re-show on a new Frame/Overlay and not on Shapes, toolbar hide, menu click rule for Hide and Pan, export size, k scaling of text and
strokes, 1:1 image copy at k > 1, 4-channel alpha, off-thread call).

Pre-release package 0.35.0-dev (CI run 41386711913) applied by one Avalonia consumer on their own machine (their measurements): no
warnings (non-incremental), no source change; in a real window on the Semi theme with a live 2448×2048 camera, light and dark, the toggle
hid the overlay and HUD and kept the shapes, came back on a new result and frame, the menu check followed the toolbar, and the saved
image had the native size, readable text and correctly placed NG marks.