/** * @brief Fill the image with a given pixel * @param fill The pixel with the color information for the fill operation */ public void Fill(Generator.Pixel fill) { for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { pixels[y * width + x] = fill; } } }
/** * @brief Apply a pattern mask to the image. 1 values of the mask will be replaced with the given pixel.Adapts the pattern to the image aspect ratio * @param pattern The mask pattern to apply * @param positive The pixel to replace in the original image */ public void ApplyPattern(byte[,] pattern, Generator.Pixel positive) { float heightRatio = (float)pattern.GetLength(0) / (float)height; float widthRatio = (float)pattern.GetLength(1) / (float)width; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { pixels[y * width + x] = pattern[(int)(y * heightRatio), (int)(x * widthRatio)] == 1 ? positive : pixels[y * width + x]; } } }