public void Noise() { var rand = new System.Random(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var c = new Color((int)((rand.NextDouble() * 255f))); pixelArray.Add(c); } } }
public Image(int width, int height) { this.width = width; this.height = height; pixelArray = new PixelArray(width, height); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { pixelArray.Add(Color.white); } } }
public void Scale(int newWidth, int newHeight) { float xScale = (float)newWidth / (float)(width - 1); float yScale = (float)newHeight / (float)(height - 1); var newPixelArray = new PixelArray(newWidth, newHeight); for (int y = 0; y < newHeight; y++) { for (int x = 0; x < newWidth; x++) { var color = GetPixel( (int)(1 + x / xScale), (int)(1 + y / yScale) ); newPixelArray.Add(color); } } width = newWidth; height = newHeight; pixelArray = newPixelArray; }