Example #1
0
        public Plasma(WriteableBitmap wbm)
        {
            plasma       = new int[wbm.PixelWidth, wbm.PixelHeight];
            colors       = HSV.RedGreenBlue();
            timer        = 1;
            this.monitor = wbm;

            for (int y = 0; y < wbm.PixelHeight; y++)
            {
                for (int x = 0; x < wbm.PixelWidth; x++)
                {
                    int c = (int)(
                        HSV.colorcount + (HSV.colorcount * Math.Sin(x / 8.0))
                        + HSV.colorcount + (HSV.colorcount * Math.Sin(y / 8.0))
                        + HSV.colorcount + (HSV.colorcount * Math.Sin((x + y) / 8.0))
                        + HSV.colorcount + (HSV.colorcount * Math.Sin(Math.Sqrt((double)(x * x + y * y)) / 8.0))
                        ) / 4;
                    plasma[x, y] = c;
                }
            }
        }