1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added DrawBitmapEfficiently method

This commit is contained in:
Logan Saso 2016-03-16 12:29:46 -07:00
parent 9304cec41c
commit de8970c5d6

View File

@ -108,6 +108,27 @@ namespace Artemis.KeyboardProviders.Corsair
CueSDK.Reinitialize();
}
/*
//Should be able to scale the keyboard instead of resizing the bitmap for better speed. TODO: Test it
public override void DrawBitmapEfficiently(Bitmap bitmap)
{
foreach (var item in _keyboard.Keys)
{
item.Led.Color = Color.Black;
var ledColor = bitmap.GetPixel(
(int) 4*(item.KeyRectangle.X/_keyboard.KeyboardRectangle.Width)*MainManager.KeyboardManager.ActiveKeyboard.Width,
(int) 4*(item.KeyRectangle.Y/_keyboard.KeyboardRectangle.Height)*MainManager.KeyboardManager.ActiveKeyboard.Height);
if (ledColor.A == 0)
continue;
item.Led.Color = Color.FromArgb(255, (int) (ledColor.R/255.00*ledColor.A),
(int) (ledColor.G/255.00*ledColor.A), (int) (ledColor.B/255.00*ledColor.A));
}
}
*/
/// <summary>
/// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap
/// size.
@ -135,4 +156,4 @@ namespace Artemis.KeyboardProviders.Corsair
_keyboard.Update(true);
}
}
}
}