Round clip: true circle (Viewbox/1x1 ellipse) + grabbable corner handle (transparent source grid, non-hit-testable selection overlay); resize locks square in round mode

This commit is contained in:
2026-08-06 15:05:21 -07:00
parent b64830ed11
commit 7bc70872d9
4 changed files with 169 additions and 24 deletions
+10 -2
View File
@@ -110,8 +110,16 @@ C# / WPF (.NET 8) following MVVM:
device never drowns the render thread.
- **Clip/mirror:** per-Source `ClipShape` (Traditional rectangle / Round ellipse) + `IsMirrored`
(`ScaleX = -1`). Rendered in the preview DataTemplate (Image for Traditional, `ImageBrush` inside an
`Ellipse` for Round); toggled from the source chip; persisted in the layout DB. Round hit-testing is the
same rectangle as Traditional (selection overlay is rectangular) — acceptable for now.
`Ellipse` for Round); toggled from the source chip; persisted in the layout DB.
- The Round `Ellipse` is wrapped in a `Viewbox Stretch="Uniform"` holding a `1x1` Grid, so it renders
as a true circle (diameter = the shorter source dimension) instead of an oval stretched to the
source rect — and the traditional `Image` keeps `UniformToFill` over the full rect.
- Resizing locks to a square (`_resizeAspect = 1`) while `ClipShape == Round`.
- **Hit-testing:** a `Grid` without `Background` only hit-tests where its children draw, so clicks in
the empty corners of a round clip fell through to `Window_PreviewMouseLeftButtonDown` and deselected
the source — making the corner handle ungrabbable. The source Grid carries `Background="Transparent"`
(whole rect draggable) and the `SelectionOverlay` (dashed border + corner dot) is
`IsHitTestVisible="False"` so it never intercepts the click.
- **GPU posture:** webcam frames are CPU (GPU-agnostic; WPF hardware-presents the preview anyway). Hardware
encoders (NVENC/AMF/QSV) matter for the encoder task, not capture. D3DImage GPU compositing is deferred
to the encoder task.