using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.GPU.Structures
{
///
/// Holds information regarding a RGB control data
///
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct IlluminationZoneControlDataRGB : IInitializable
{
private const int MaximumNumberOfDataBytes = 64;
private const int MaximumNumberOfReservedBytes = 64;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MaximumNumberOfDataBytes)]
internal byte[] _Data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MaximumNumberOfReservedBytes)]
internal byte[] _Reserved;
///
/// Creates a new instance of .
///
/// The zone manual control data.
public IlluminationZoneControlDataRGB(IlluminationZoneControlDataManualRGB manualRGB)
: this(manualRGB.ToByteArray())
{
}
///
/// Creates a new instance of .
///
/// The zone piecewise linear control data.
public IlluminationZoneControlDataRGB(IlluminationZoneControlDataPiecewiseLinearRGB piecewiseLinearRGB)
: this(piecewiseLinearRGB.ToByteArray())
{
}
private IlluminationZoneControlDataRGB(byte[] data)
{
if (!(data?.Length > 0) || data.Length > MaximumNumberOfDataBytes)
{
throw new ArgumentOutOfRangeException(nameof(data));
}
this = typeof(IlluminationZoneControlDataRGB).Instantiate();
Array.Copy(data, 0, _Data, 0, data.Length);
}
///
/// Gets the control data as a manual control structure.
///
/// An instance of containing manual settings.
public IlluminationZoneControlDataManualRGB AsManual()
{
return _Data.ToStructure();
}
///
/// Gets the control data as a piecewise linear control structure.
///
///
/// An instance of containing piecewise linear
/// settings.
///
public IlluminationZoneControlDataPiecewiseLinearRGB AsPiecewise()
{
return _Data.ToStructure();
}
}
}