17 lines
757 B
C#
17 lines
757 B
C#
using ytLive.Models;
|
|
|
|
namespace ytLive.Services.BackgroundEffects;
|
|
|
|
/// <summary>Identifies one rendered variant of a camera's frames (TASK 51): the effect plus its
|
|
/// strength, rounded to 2 decimals so a slider drag doesn't spawn a variant per pixel of travel.
|
|
/// <see cref="BackgroundEffect.None"/> always normalizes to strength 0 — the raw path.</summary>
|
|
public readonly record struct WebcamEffectKey(BackgroundEffect Effect, double Strength)
|
|
{
|
|
public static WebcamEffectKey None => new(BackgroundEffect.None, 0);
|
|
|
|
public static WebcamEffectKey For(BackgroundEffect effect, double strength)
|
|
=> effect == BackgroundEffect.None
|
|
? None
|
|
: new WebcamEffectKey(effect, Math.Round(Math.Clamp(strength, 0, 1), 2));
|
|
}
|