mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System.Runtime.InteropServices;
|
|
|
|
namespace GHelper.Display
|
|
{
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct GammaRamp
|
|
{
|
|
public const int DataPoints = 256;
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
|
public readonly ushort[] Red;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
|
public readonly ushort[] Green;
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DataPoints)]
|
|
public readonly ushort[] Blue;
|
|
|
|
public GammaRamp(ushort[] red, ushort[] green, ushort[] blue)
|
|
{
|
|
if (red == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(red));
|
|
}
|
|
|
|
if (green == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(green));
|
|
}
|
|
|
|
if (blue == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(blue));
|
|
}
|
|
|
|
if (red.Length != DataPoints)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(red));
|
|
}
|
|
|
|
if (green.Length != DataPoints)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(green));
|
|
}
|
|
|
|
if (blue.Length != DataPoints)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(blue));
|
|
}
|
|
|
|
Red = red;
|
|
Green = green;
|
|
Blue = blue;
|
|
}
|
|
}
|
|
|
|
} |