Esempio n. 1
0
        /// <summary>
        /// Save the current Spectrum Color layout to the keyboard.
        /// Changing profile without saving first will lose all changes made to the profile.
        /// </summary>
        /// <param name="profile">The profile to save. This should be the active profile.</param>
        public void SaveSpectrumColors(TesoroProfile profile)
        {
            // Prepare the command data
            byte[] data = { 0x07, 0x0D, (byte)profile, 0xFF, 0x00, 0x00, 0x00, 0x00 };

            // Send the data
            device.writeFeature(data);
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the main background Color for standard effects
        /// </summary>
        /// <param name="r">Red exponent 0-255</param>
        /// <param name="g">Green exponent 0-255</param>
        /// <param name="b">Blue exponent 0-255</param>
        /// <param name="profile">The profile to modify. This should be the active profile.</param>
        public void SetProfileColor(int r, int g, int b, TesoroProfile profile)
        {
            // Prepare the command data
            byte[] data = { 0x07, 0x0B, (byte)profile, IntToByte(r), IntToByte(g), IntToByte(b), 0x00, 0x00 };

            // Send the data
            device.writeFeature(data);
        }
Esempio n. 3
0
        /// <summary>
        /// Sets the main background Color for standard effects
        /// </summary>
        /// <param name="mode">Lighting mode</param>
        /// <param name="spectrumMode">Lighting sub-mode for spectrum Color. Should be 0x00 for non-spectrum modes</param>
        /// <param name="profile">The profile to modify. This should be the active profile.</param>
        public void SetLightingMode(LightingMode mode, SpectrumMode spectrumMode, TesoroProfile profile)
        {
            // Prepare the command data
            byte[] data = { 0x07, 0x0A, (byte)profile, (byte)mode, (byte)spectrumMode, 0x00, 0x00, 0x00 };

            // Send the data
            device.writeFeature(data);
        }
Esempio n. 4
0
        /// <summary>
        /// Set the keyboard to display the designated profile
        /// </summary>
        /// <param name="profile">The profile to change to.</param>
        public void SetProfile(TesoroProfile profile)
        {
            // Prepare the command data
            byte[] data = { 0x07, 0x03, (byte)profile, 0x00, 0x00, 0x00, 0x00, 0x00 };

            // Send the data
            device.writeFeature(data);
        }
Esempio n. 5
0
        /// <summary>
        /// Sets the LED of a single key using 0-255 integers.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="r">Red exponent 0-255</param>
        /// <param name="g">Green exponent 0-255</param>
        /// <param name="b">Blue exponent 0-255</param>
        /// <param name="profile">The profile to modify. This should be the active profile.</param>
        public void SetKeyColor(TesoroLedID key, int r, int g, int b, TesoroProfile profile)
        {
            if (key == TesoroLedID.None)
            {
                return;
            }

            // Prepare the command data
            byte[] data = { 0x07, 0x0D, (byte)profile, (byte)key, IntToByte(r), IntToByte(g), IntToByte(b), 0x00 };

            // Send the data
            device.writeFeature(data);
        }
Esempio n. 6
0
        /// <summary>
        /// Set all LEDs using a Bitmap object. Image will be scaled to fit the keyboard
        /// </summary>
        /// <param name="bitmap">A Bitmap object describing the desired pattern.</param>
        /// <param name="profile">The profile to modify. This should be the active profile.</param>
        /// <param name="fast">True - speeds up execution at the risk of missed pixels. Recomended true for animated effects, false for static effects.</param>
        void SetKeysColor(Bitmap bitmap, TesoroProfile profile, bool fast)
        {
            if (bitmap.Width > width || bitmap.Height > height)
            {
                bitmap = new Bitmap(bitmap, width, height);
            }
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    // get pixel (using tiling for small bitmaps)
                    Color col = bitmap.GetPixel(x, y);

                    // set Color
                    SetKeyColor(keyPositions[x, y], col.R, col.G, col.B, profile);
                    // delay between sends
                    Wait(fast);
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Set the LEDs for all using an image file. Image will be scaled to fit the keyboard
        /// </summary>
        /// <param name="file">Path to an image file describing the desired pattern.</param>
        /// <param name="profile">The profile to modify. This should be the active profile.</param>
        /// <param name="fast">True - speeds up execution at the risk of missed pixels. Recomended true for animated effects, false for static effects.</param>
        public void SetKeysColor(string file, TesoroProfile profile, bool fast)
        {
            Image image = Image.FromFile(file);

            SetKeysColor(new Bitmap(image), profile, fast);
        }
Esempio n. 8
0
 /// <summary>
 /// Sets the main background Color for standard effects
 /// </summary>
 /// <param name="mode">Lighting mode</param>
 /// <param name="profile">The profile to modify.</param>
 public void SetLightingMode(LightingMode mode, TesoroProfile profile)
 {
     SetLightingMode(mode, 0x00, profile);
 }