TASK 51 slice 5: webcam Background section in the Layers properties — Remove/Blur PillToggles (radio-exclusive) + Strength slider; strength changes never blank the webcam (new variant inherits the same-effect frame + bitmap). TASK 51 built (Unit: bg-effects UI)

This commit is contained in:
2026-10-09 10:31:11 -07:00
parent de22983b36
commit 352f117cb2
11 changed files with 169 additions and 49 deletions
+14 -4
View File
@@ -380,14 +380,24 @@ public sealed class CameraManager : IDisposable
}, DispatcherPriority.Render);
}
// Caller holds _gate.
// Caller holds _gate. A new key inherits the last frame + bitmap of a dropped variant with
// the SAME effect (a strength change), so neither the stream nor the preview blanks for a
// frame while the creator drags the strength slider.
private static void SyncVariants(CameraSession session, HashSet<WebcamEffectKey> keys)
{
foreach (var stale in session.Effects.Keys.Where(k => !keys.Contains(k)).ToList())
var dropped = session.Effects.Where(kv => !keys.Contains(kv.Key)).ToList();
foreach (var (stale, _) in dropped)
session.Effects.Remove(stale);
foreach (var key in keys)
if (!session.Effects.ContainsKey(key))
session.Effects[key] = new EffectVariant();
{
if (session.Effects.ContainsKey(key)) continue;
var heir = dropped.FirstOrDefault(kv => kv.Key.Effect == key.Effect).Value;
session.Effects[key] = new EffectVariant
{
LatestFrame = heir?.LatestFrame,
PreviewBitmap = heir?.PreviewBitmap,
};
}
}
private void ScheduleEffects(CameraSession session)