Пример #1
0
        public void Themometer()
        {
            PixelColour[] palette = new PixelColour[]
            {
                PixelColour.Red,
                PixelColour.OrangeRed,
                PixelColour.Orange,
                PixelColour.Yellow,
                PixelColour.YellowGreen,
                PixelColour.Green,
                PixelColour.Blue,
                PixelColour.BlueViolet,
                PixelColour.Indigo,
                PixelColour.Violet,
            };

            SetLevel(100, palette, true, 7, 10);
        }
Пример #2
0
        private static PixelColour[] GetPixelColourList(Hashtable result, string propertyName)
        {
            PixelColour[] answer = new PixelColour[0];
            var           key    = getKey(result, propertyName);

            if (key != null)
            {
                var pixelColours = (ArrayList)result[key];
                if (pixelColours != null)
                {
                    answer = new PixelColour[pixelColours.Count];
                    int pos = 0;
                    foreach (long c in pixelColours)
                    {
                        answer[pos] = (PixelColour)(int)c;
                        pos++;
                    }
                }
            }

            return(answer);
        }
Пример #3
0
 /// <summary>
 /// pass a PixelColour enum and get the corresponding Pixel of that colour
 /// assumes that the colourList and the PixelColour enum are in sync
 /// </summary>
 /// <param name="pixelColour">PixelColour of the pixel required</param>
 /// <returns></returns>
 protected Pixel getPixel(PixelColour pixelColour)
 {
     return(PaletteFullColour[(int)pixelColour]);
 }
Пример #4
0
 /// <summary>
 /// Lights up a percentage of the strip
 /// </summary>
 /// <param name="percent">percentage of the strip to light up (0-100)</param>
 /// <param name="colour">Colour to light the strip</param>
 /// <param name="stepUp">Should the strip animate to this level</param>
 /// <param name="increment">Animation step size (percentage)</param>
 /// <param name="stepDelay">ms Delay between animation steps</param>
 public void SetLevel(ushort percent, PixelColour colour = PixelColour.Red, bool stepUp = false, ushort increment = 1, int stepDelay = 250)
 {
     SetLevel(percent, getPixel(colour), stepUp, increment, stepDelay);
 }
        private static PixelColour[] GetPixelColourList(Hashtable result, string propertyName)
        {
            PixelColour[] answer = new PixelColour[0];
            var key = getKey(result, propertyName);
            if (key != null)
            {
                var pixelColours = (ArrayList)result[key];
                if (pixelColours != null)
                {
                    answer = new PixelColour[pixelColours.Count];
                    int pos = 0;
                    foreach (long c in pixelColours)
                    {
                        answer[pos] = (PixelColour)(int)c;
                        pos++;
                    }
                }
            }

            return answer;
        }
 /// <summary>
 /// pass a PixelColour enum and get the corresponding Pixel of that colour
 /// assumes that the colourList and the PixelColour enum are in sync
 /// </summary>
 /// <param name="pixelColour">PixelColour of the pixel required</param>
 /// <returns></returns>
 protected Pixel getPixel(PixelColour pixelColour)
 {
     return PaletteFullColour[(int)pixelColour];
 }
 protected Pixel[] GetColourListFromColourSet(PixelColour[] colourSet)
 {
     var colourList = new Pixel[colourSet.Length];
     for (int i = 0; i < colourSet.Length; i++) {
         colourList[i] = getPixel(colourSet[i]);
     }
     return colourList;
 }
Пример #8
0
 /// <summary>
 /// pass a PixelColour enum and get the corresponding Pixel of that colour
 /// assumes that the colourList and the PixelColour enum are in sync
 /// </summary>
 /// <param name="pixelColour">PixelColour of the pixel required</param>
 /// <returns></returns>
 protected Pixel getPixel(PixelColour pixelColour)
 {
     return(colourList[(int)pixelColour]);
 }
        public void Themometer()
        {
            PixelColour[] palette = new PixelColour[]
            {
                PixelColour.Red,
                PixelColour.OrangeRed,
                PixelColour.Orange,
                PixelColour.Yellow,
                PixelColour.YellowGreen,
                PixelColour.Green,
                PixelColour.Blue,
                PixelColour.BlueViolet,
                PixelColour.Indigo,
                PixelColour.Violet,
            };

            SetLevel(100, palette, true, 7, 10);
        }
        /// <summary>
        /// Lights up a percentage of the strip with the colour changing based on the array of pixels passed
        /// </summary>
        /// <param name="percent">percentage of the strip to light (0-100)</param>
        /// <param name="palette">Colours to use. Strip will be evenly divided. If a colour would only appear at a level above percent, it will not be shown</param>
        /// <param name="stepUp">Should the strip animate to this level</param>
        /// <param name="increment">Animation step size (percentage)</param>
        /// <param name="stepDelay">ms Delay between animation steps</param>
        public void SetLevel(ushort percent, PixelColour[] palette, bool stepUp = false, ushort increment = 1, int stepDelay = 250)
        {
            Pixel[] p = new Pixel[palette.Length];
            for (int i = 0; i < palette.Length; i++)
            {
                p[i] = getPixel(palette[i]);
            }

            SetLevel(percent, p, stepUp, increment, stepDelay);
        }
 /// <summary>
 /// Lights up a percentage of the strip
 /// </summary>
 /// <param name="percent">percentage of the strip to light up (0-100)</param>
 /// <param name="colour">Colour to light the strip</param>
 /// <param name="stepUp">Should the strip animate to this level</param>
 /// <param name="increment">Animation step size (percentage)</param>
 /// <param name="stepDelay">ms Delay between animation steps</param>
 public void SetLevel(ushort percent, PixelColour colour = PixelColour.Red, bool stepUp = false, ushort increment = 1, int stepDelay = 250)
 {
     SetLevel(percent, getPixel(colour), stepUp, increment, stepDelay);
 }