Animatroller.Framework.LogicalDevice.Pixel1D.SetColors C# (CSharp) Method

SetColors() public method

public SetColors ( int startChannel, ColorBrightness colorBrightness ) : Pixel1D
startChannel int
colorBrightness ColorBrightness
return Pixel1D
        public virtual Pixel1D SetColors(int startChannel, ColorBrightness[] colorBrightness)
        {
            int? firstChannel = null;
            int lastChannel = 0;
            for (int i = 0; i < colorBrightness.Length; i++)
            {
                if (i + startChannel < 0)
                    continue;
                if (i + startChannel >= Pixels)
                    continue;

                if (!firstChannel.HasValue)
                    firstChannel = i + startChannel;
                lastChannel = i + startChannel;

                this.color[i + startChannel] = colorBrightness[i].Color;
                this.brightness[i + startChannel] = colorBrightness[i].Brightness;
            }

            if (firstChannel.HasValue)
                RaiseMultiPixelChanged(firstChannel.Value, lastChannel - firstChannel.Value + 1);

            return this;
        }