using System.Windows.Media; namespace ytLive.Models; /// /// A scene's usage of the app-wide webcam — conceptually `webcam.{scene}.config`. /// The identity lives once on the entity; this object is that /// scene's placement, clip/mirror, border, and visibility for it. Exists only in /// scenes where the creator added the webcam. /// public class WebcamSceneConfig : SceneElement { public string WebcamId { get; init; } = string.Empty; public override bool IsWebcam => true; public override bool IsDraggable => true; public override ElementKind Kind => ElementKind.Dynamic; public override ImageSource? DisplaySource => VideoImageSource; private BackgroundEffect _backgroundEffect = BackgroundEffect.None; /// TASK 51: this scene's background effect for the webcam (persisted). public BackgroundEffect BackgroundEffect { get => _backgroundEffect; set { if (!Set(ref _backgroundEffect, value)) return; Raise(nameof(RemoveBackground)); Raise(nameof(BlurBackground)); Raise(nameof(HasBackgroundEffect)); } } /// True while Remove or Blur is on — shows the strength slider. public bool HasBackgroundEffect => BackgroundEffect != BackgroundEffect.None; private double _backgroundStrength = 0.5; /// TASK 51: 0..1 — Blur amount, or Remove's edge softness (persisted). public double BackgroundStrength { get => _backgroundStrength; set => Set(ref _backgroundStrength, Math.Clamp(value, 0, 1)); } /// Pill-switch surface: Remove and Blur behave like radio buttons — turning one /// on turns the other off; turning the active one off means . public bool RemoveBackground { get => BackgroundEffect == BackgroundEffect.Remove; set => BackgroundEffect = value ? BackgroundEffect.Remove : BackgroundEffect == BackgroundEffect.Remove ? BackgroundEffect.None : BackgroundEffect; } /// public bool BlurBackground { get => BackgroundEffect == BackgroundEffect.Blur; set => BackgroundEffect = value ? BackgroundEffect.Blur : BackgroundEffect == BackgroundEffect.Blur ? BackgroundEffect.None : BackgroundEffect; } }