From ccd63abe9a6e1b5f326c1c8a8bd17bbac7ae4c3e Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Mon, 8 Jan 2018 11:52:13 +0100 Subject: [PATCH] 1.11.2.0 Fixed G910 and G810 alignment issues Bumped version number --- .../HeatGeneratedFileList.wxs | 4 +++ Artemis/Artemis.Installer/Product.wxs | 2 +- .../Artemis/DeviceProviders/Logitech/G810.cs | 29 ++++++++++-------- .../Artemis/DeviceProviders/Logitech/G910.cs | 30 +++++++++++-------- Artemis/Artemis/Properties/AssemblyInfo.cs | 4 +-- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Artemis/Artemis.Installer/HeatGeneratedFileList.wxs b/Artemis/Artemis.Installer/HeatGeneratedFileList.wxs index 1148775d8..1269c787e 100644 --- a/Artemis/Artemis.Installer/HeatGeneratedFileList.wxs +++ b/Artemis/Artemis.Installer/HeatGeneratedFileList.wxs @@ -2,6 +2,9 @@ + + + @@ -210,6 +213,7 @@ + diff --git a/Artemis/Artemis.Installer/Product.wxs b/Artemis/Artemis.Installer/Product.wxs index 5620cb154..1bbee5ed5 100644 --- a/Artemis/Artemis.Installer/Product.wxs +++ b/Artemis/Artemis.Installer/Product.wxs @@ -2,7 +2,7 @@ - + diff --git a/Artemis/Artemis/DeviceProviders/Logitech/G810.cs b/Artemis/Artemis/DeviceProviders/Logitech/G810.cs index d6d7538c8..1db03fd91 100644 --- a/Artemis/Artemis/DeviceProviders/Logitech/G810.cs +++ b/Artemis/Artemis/DeviceProviders/Logitech/G810.cs @@ -28,28 +28,31 @@ namespace Artemis.DeviceProviders.Logitech } /// - /// The G910 also updates the G-logo, G-badge and G-keys + /// The 8910 also updates the G-logo and G-badge /// /// public override void DrawBitmap(Bitmap bitmap) { - using (var croppedBitmap = new Bitmap(21 * 4, 6 * 4)) + // Base all actions on a downscaled bitmap since the bitmap is received upscaled + using (var resized = OrionUtilities.ResizeImage(bitmap, Width, Height)) { // Deal with non-standard DPI - croppedBitmap.SetResolution(96, 96); - // Don't forget that the image is upscaled 4 times - using (var g = Graphics.FromImage(croppedBitmap)) + resized.SetResolution(96, 96); + + // LogiLedSetLightingFromBitmap doesn't include the special keys so cut the supported keys out of + // the received bitmap and send them to the SDK as a whole + using (var croppedBitmap = new Bitmap(Width - 1, Height - 1)) { - g.DrawImage(bitmap, new Rectangle(0, 0, 84, 24), new Rectangle(4, 4, 84, 24), GraphicsUnit.Pixel); + croppedBitmap.SetResolution(96, 96); + using (var g = Graphics.FromImage(croppedBitmap)) + { + g.DrawImage(resized, new Rectangle(0, 0, Width - 1, Height - 1), new Rectangle(1, 1, Width - 1, Height - 1), GraphicsUnit.Pixel); + } + + LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB); + LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(croppedBitmap)); } - LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB); - // TODO: Remapping - LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap)); - } - - using (var resized = OrionUtilities.ResizeImage(bitmap, 21, 7)) - { // Color G-logo, lets also try some other values to see what happens SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 0); SetLogitechColorFromCoordinates(resized, KeyboardNames.G_BADGE, 0, 0); diff --git a/Artemis/Artemis/DeviceProviders/Logitech/G910.cs b/Artemis/Artemis/DeviceProviders/Logitech/G910.cs index 295c5be3c..26f8ba6a3 100644 --- a/Artemis/Artemis/DeviceProviders/Logitech/G910.cs +++ b/Artemis/Artemis/DeviceProviders/Logitech/G910.cs @@ -54,22 +54,26 @@ namespace Artemis.DeviceProviders.Logitech /// public override void DrawBitmap(Bitmap bitmap) { - using (var croppedBitmap = new Bitmap(21 * 4, 6 * 4)) + // Base all actions on a downscaled bitmap since the bitmap is received upscaled + using (var resized = OrionUtilities.ResizeImage(bitmap, Width, Height)) { // Deal with non-standard DPI - croppedBitmap.SetResolution(96, 96); - // Don't forget that the image is upscaled 4 times - using (var g = Graphics.FromImage(croppedBitmap)) + resized.SetResolution(96, 96); + + // LogiLedSetLightingFromBitmap doesn't include the special keys so cut the supported keys out of + // the received bitmap and send them to the SDK as a whole + using (var croppedBitmap = new Bitmap(Width - 1, Height - 1)) { - g.DrawImage(bitmap, new Rectangle(0, 0, 84, 24), new Rectangle(4, 4, 84, 24), GraphicsUnit.Pixel); + croppedBitmap.SetResolution(96, 96); + using (var g = Graphics.FromImage(croppedBitmap)) + { + g.DrawImage(resized, new Rectangle(0, 0, Width-1, Height-1), new Rectangle(1, 1, Width - 1, Height - 1), GraphicsUnit.Pixel); + } + + LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB); + LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(croppedBitmap, G910Keymappings)); } - - LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB); - LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap, G910Keymappings)); - } - - using (var resized = OrionUtilities.ResizeImage(bitmap, 22, 7)) - { + // Color the extra keys on the left side of the keyboard SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 1); SetLogitechColorFromCoordinates(resized, KeyboardNames.G_1, 0, 2); @@ -232,4 +236,4 @@ namespace Artemis.DeviceProviders.Logitech new OrionUtilities.KeyMapping(124, 124) }; } -} +} \ No newline at end of file diff --git a/Artemis/Artemis/Properties/AssemblyInfo.cs b/Artemis/Artemis/Properties/AssemblyInfo.cs index e801ee23d..9125ad076 100644 --- a/Artemis/Artemis/Properties/AssemblyInfo.cs +++ b/Artemis/Artemis/Properties/AssemblyInfo.cs @@ -53,6 +53,6 @@ using System.Windows; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.11.1.0")] -[assembly: AssemblyFileVersion("1.11.1.0")] +[assembly: AssemblyVersion("1.11.2.0")] +[assembly: AssemblyFileVersion("1.11.2.0")] [assembly: InternalsVisibleTo("Artemis.Explorables")]