-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHue.cs
More file actions
33 lines (28 loc) · 786 Bytes
/
Hue.cs
File metadata and controls
33 lines (28 loc) · 786 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 Hue : ValueObject
{
private readonly double value;
private Hue(double value)
{
Ensure.Argument.Is(value >= 0 && value <= 360, "Hue value must be between 0 and 360.");
this.value = value;
}
public static Hue FromScalar(double value)
{
return new Hue(value);
}
public static implicit operator double(Hue hue)
{
return hue.value;
}
public static explicit operator Hue(int value)
{
return new Hue(value);
}
protected override IEnumerable<object> GetAtomicValues()
{
yield return value;
}
}
}