forked from dantmnf/MHC2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimaries.cs
More file actions
41 lines (37 loc) · 1.63 KB
/
Copy pathPrimaries.cs
File metadata and controls
41 lines (37 loc) · 1.63 KB
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
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LittleCms;
namespace MHC2Gen
{
internal struct CIExy
{
public double x;
public double y;
public CIEXYZ ToXYZ(double Y = 1.0)
{
return new() { X = x * Y / y, Y = Y, Z = (1 - x - y) * Y / y };
}
}
internal record class RgbPrimaries
{
public CIExy Red { get; init; }
public CIExy Green { get; init; }
public CIExy Blue { get; init; }
public CIExy White { get; init; }
private RgbPrimaries() { }
public RgbPrimaries(CIExy red, CIExy green, CIExy blue, CIExy white)
{
Red = red;
Green = green;
Blue = blue;
White = white;
}
public static RgbPrimaries sRGB { get; } = new RgbPrimaries(new() { x = 0.64, y = 0.33 }, new() { x = 0.30, y = 0.60 }, new() { x = 0.15, y = 0.06 }, new() { x = 0.3127, y = 0.3290 });
public static RgbPrimaries AdobeRGB { get; } = new RgbPrimaries(new() { x = 0.64, y = 0.33 }, new() { x = 0.21, y = 0.71 }, new() { x = 0.15, y = 0.06 }, new() { x = 0.3127, y = 0.3290 });
public static RgbPrimaries P3D65 { get; } = new RgbPrimaries(new() { x = 0.68, y = 0.32 }, new() { x = 0.265, y = 0.690 }, new() { x = 0.15, y = 0.06 }, new() { x = 0.3127, y = 0.3290 });
public static RgbPrimaries Rec2020 { get; } = new RgbPrimaries(new() { x = 0.708, y = 0.292 }, new() { x = 0.170, y = 0.797 }, new() { x = 0.131, y = 0.046 }, new() { x = 0.3127, y = 0.3290 });
}
}