using System; using RGB.NET.Core; using RGB.NET.Devices.Logitech.Native; namespace RGB.NET.Devices.Logitech { /// /// Represents the update-queue performing updates for logitech per-key devices. /// public class LogitechPerKeyUpdateQueue : UpdateQueue { #region Properties & Fields private readonly byte[] _bitmap; #endregion #region Constructors /// /// Initializes a new instance of the class. /// /// The update trigger used by this queue. public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger) : base(updateTrigger) { _bitmap = BitmapMapping.CreateBitmap(); } #endregion #region Methods /// protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) { _LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.PerKeyRGB); Array.Clear(_bitmap, 0, _bitmap.Length); foreach ((object key, Color color) in dataSet) BitmapMapping.SetColor(_bitmap, (int)key, color); _LogitechGSDK.LogiLedSetLightingFromBitmap(_bitmap); } #endregion } }