Ejemplo n.º 1
0
        public static Color[] Rough(int w, int h, Color color)
        {
            var pixels = None(w, h, color);

            WhiteNoise.SetFrequency(0.25f);
            WhiteNoise.SetFractalOctaves(2);
            WhiteNoise.SetFractalType(FractalType.Billow);
            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    var val   = WhiteNoise.GetSimplexFractal(x, y);
                    var multi = PixelMath.Map(val, -1, 1, 0, 1);
                    pixels[(y * w) + x].A = (byte)(pixels[(y * w) + x].A * multi);
                }
            }
            return(pixels);
        }