Exemplo n.º 1
0
        public override void DrawBitmap(Bitmap bitmap)
        {
            // Resize the bitmap
            using (var b = ImageUtilities.ResizeImage(bitmap, Width, Height))
            {
                // Create an empty matrix
                var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};

                // Map the bytes to the matix
                for (var x = 0; x < Width; x++)
                {
                    for (var y = 0; y < Height; y++)
                    {
                        var c = b.GetPixel(x, y);
                        if (c.R != 0)
                            Console.WriteLine();
                        matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
                    }
                }

                // Send the matrix to the keyboard
                CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
                CmSdk.SetAllLedColor(matrix);
            }
        }
Exemplo n.º 2
0
        public override void UpdateDevice(Bitmap bitmap)
        {
            // Create an empty matrix
            var matrix = new COLOR_MATRIX {
                KeyColor = new KEY_COLOR[6, 22]
            };

            // Get colors from the bitmap's center X and on 1/3rd and 2/3rd Y
            var x         = bitmap.Width / 2;
            var y         = bitmap.Width / 3;
            var led1Color = bitmap.GetPixel(x, y);
            var led2Color = bitmap.GetPixel(x, y * 2);

            matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
            matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);

            // Send the matrix to the mouse
            CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
            CmSdk.SetAllLedColor(matrix);
        }