66 lines
1.7 KiB
C#
66 lines
1.7 KiB
C#
using System.Windows.Media;
|
|
using ytLive.Helpers;
|
|
|
|
namespace ytLive.Models;
|
|
|
|
public enum SourceType
|
|
{
|
|
DisplayCapture,
|
|
WindowCapture,
|
|
Background,
|
|
Image,
|
|
TextOverlay
|
|
}
|
|
|
|
public enum ClipShape
|
|
{
|
|
Traditional,
|
|
Round
|
|
}
|
|
|
|
/// <summary>
|
|
/// A multi-instance scene object: image/background/text (screen/window later).
|
|
/// The webcam is NOT a Source — it's a singleton resource whose per-scene usage
|
|
/// is a <see cref="WebcamSceneConfig"/>. See the singleton-vs-multi-instance
|
|
/// discriminator in ai.md.
|
|
/// </summary>
|
|
public class Source : SceneElement
|
|
{
|
|
private SourceType _type;
|
|
public SourceType Type { get => _type; set => Set(ref _type, value); }
|
|
|
|
private bool _isEnabled = true;
|
|
public bool IsEnabled { get => _isEnabled; set => Set(ref _isEnabled, value); }
|
|
|
|
// Display/Window capture
|
|
private int? _monitorIndex;
|
|
public int? MonitorIndex { get => _monitorIndex; set => Set(ref _monitorIndex, value); }
|
|
|
|
private IntPtr? _windowHandle;
|
|
public IntPtr? WindowHandle { get => _windowHandle; set => Set(ref _windowHandle, value); }
|
|
|
|
// Image (asset stored in the layout database)
|
|
private string? _assetId;
|
|
private ImageSource? _imageSource;
|
|
|
|
public string? AssetId
|
|
{
|
|
get => _assetId;
|
|
set
|
|
{
|
|
if (Set(ref _assetId, value))
|
|
{
|
|
_imageSource = ImageCache.Get(value ?? string.Empty);
|
|
Raise(nameof(ImageSource));
|
|
Raise(nameof(DisplaySource));
|
|
}
|
|
}
|
|
}
|
|
|
|
public ImageSource? ImageSource => _imageSource;
|
|
|
|
public override ImageSource? DisplaySource => _imageSource;
|
|
|
|
public override bool IsImageSource => Type == SourceType.Image;
|
|
}
|