Exemplo n.º 1
0
        public override void update(ref VideoBuffer videoBuffer)
        {
            try
            {
                /*// loops through image and copied it into the buffer
                 * for (int y = _positionY; y < _image.Height + _positionY; y++)
                 * {
                 *  for (int x = _positionX; x < _image.Width + _positionY; x++)
                 *  {
                 *      if(x >= 0 && y >= 0 && x < videoBuffer.Width && y < videoBuffer.Height)
                 *          videoBuffer.Buffer[y, x] = colorToRGB(_image.GetPixel(x, y));
                 *  }
                 * }*/


                // loops through video buffer and
                for (int y = 0; y < videoBuffer.Height; y++)
                {
                    for (int x = 0; x < videoBuffer.Width; x++)
                    {
                        if (x - _positionX >= 0 && y - _positionY >= 0 && x - _positionX < _image.Width && y - _positionY < _image.Height)
                        {
                            if (_image.GetPixel(x, y).A != 0) // dont render transparrent pixels
                            {
                                videoBuffer.setPixel(x, y, colorToRGB(_image.GetPixel(x - _positionX, y - _positionY)));
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                //TODO: Proper exceptions
            }
        }
        public override void update(ref VideoBuffer videoBuffer)
        {
            for (int y = 0; y < videoBuffer.Height; y++)
            {
                for (int x = 0; x < videoBuffer.Width; x++)
                {
                    int r = BitConverter.GetBytes(videoBuffer.getPixel(x, y))[0];
                    int g = BitConverter.GetBytes(videoBuffer.getPixel(x, y))[1];
                    int b = BitConverter.GetBytes(videoBuffer.getPixel(x, y))[2];

                    //Color color = Color.FromArgb(r, g, b);
                    //TODO: replace all this for ControlPaint.Light/ControlPaint.Darken using System.Drawing.Color instead

                    double h = 0;
                    double l = 0;
                    double s = 0;

                    RgbToHls(r, g, b, out h, out l, out s);

                    //TODO: This is a quick way to get around transparency. Need a better way.
                    if (videoBuffer.getPixel(x, y) != 0x000000)
                    {
                        l = Brightness;
                    }

                    HlsToRgb(h, l, s, out r, out g, out b);

                    int rgb = b << 8 | g;
                    rgb = rgb << 8 | r;

                    videoBuffer.setPixel(x, y, (uint)rgb);
                }
            }
        }
Exemplo n.º 3
0
        public override void update(ref VideoBuffer videoBuffer)
        {
            foreach (Line line in _lines)
            {
                for (int y = 0; y < line.Length; y++)
                {
                    if (line.X >= 0 && line.Y >= 0 && line.X < videoBuffer.Width && line.Y + y < videoBuffer.Height)
                    {
                        videoBuffer.setPixel(line.X, line.Y + y, line.Colour);
                    }
                }
            }

            if (!intervalReached())
            {
                return;
            }
            foreach (Line line in _lines)
            {
                line.Y += _random.Next(3);

                if (line.Y >= videoBuffer.Height)
                {
                    line.Y = 0;
                }

                line.X += _random.Next(2);
                if (line.X >= videoBuffer.Width)
                {
                    line.X = 0;
                }
            }
            Timer.Restart();
        }
Exemplo n.º 4
0
        public override void update(ref VideoBuffer videoBuffer)
        {
            if (!intervalReached())
            {
                return;                     // only update if interval met
            }
            // loop through entire video buffer and generte random values
            for (int y = 0; y < videoBuffer.Height; y++)
            {
                for (int x = 0; x < videoBuffer.Width; x++)
                {
                    // generate random RGB values
                    int r = Random.Next(255);
                    int g = Random.Next(255);
                    int b = Random.Next(255);

                    // bit shift the RGB values into one int
                    int rgb = b << 8 | g;
                    rgb = rgb << 8 | r;

                    videoBuffer.setPixel(x, y, (uint)rgb);  // set the VideoBuffer value at x, y to the randomised RGB value
                }
            }

            isComplete = true;
            reset();
        }
Exemplo n.º 5
0
        public override void update(ref VideoBuffer videoBuffer)
        {
            if (!intervalReached())
            {
                return;                     // only update if interval met
            }
            for (int y = 0; y <= this.endY; y++)
            {
                for (int x = 0; x <= this.endX; x++)
                {
                    videoBuffer.setPixel(flip ? videoBuffer.Width - x - 1 : x, y, colour);
                }
            }

            endX++;

            if (endX >= videoBuffer.Width)
            {
                endX = 0;
                flip = !flip;
                endY++;
            }

            if (endY >= videoBuffer.Height)
            {
                endX = 0;
                endY = 0;
            }

            reset();
        }
Exemplo n.º 6
0
 public override void update(ref VideoBuffer videoBuffer)
 {
     for (int x = 0; x < videoBuffer.Width; x++)
     {
         for (int y = 0; y < videoBuffer.Height; y++)
         {
             videoBuffer.setPixel(x, y, colour);
         }
     }
 }
 public override void update(ref VideoBuffer videoBuffer)
 {
     for (int x = 0; x < videoBuffer.Width; x++)
     {
         for (int y = (videoBuffer.Height / 8) * 7; y < videoBuffer.Height; y++)
         {
             colour = (uint)random.Next(180, 255) << 8 | (uint)random.Next(180, 255);
             colour = this.colour << 8 | (uint)random.Next(100, 255);
             videoBuffer.setPixel(x, y, colour);
         }
     }
 }