-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaturation.cs
More file actions
33 lines (28 loc) · 845 Bytes
/
Saturation.cs
File metadata and controls
33 lines (28 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace ValueObjects.Images
{
public class Saturation : ValueObject
{
private readonly double value;
private Saturation(double value)
{
Ensure.Argument.Is(value >= 0 && value <= 100, "Saturation value must be between 0 and 100.");
this.value = value;
}
public static Saturation FromScalar(double value)
{
return new Saturation(value);
}
public static implicit operator double(Saturation hue)
{
return hue.value;
}
public static explicit operator Saturation(double value)
{
return new Saturation(value);
}
protected override IEnumerable<object> GetAtomicValues()
{
yield return value;
}
}
}