From 8cad7a112ea1e37c120a9214aa0313ad29f04ede Mon Sep 17 00:00:00 2001 From: Scott W Harden Date: Mon, 7 Nov 2022 20:13:55 -0500 Subject: [PATCH] raw bitmap: ramps --- projects/bitmap-raw/BitmapGenerator.cs | 17 +++++++++++++++++ projects/bitmap-raw/Program.cs | 1 + 2 files changed, 18 insertions(+) diff --git a/projects/bitmap-raw/BitmapGenerator.cs b/projects/bitmap-raw/BitmapGenerator.cs index ee5422c..e3576dc 100644 --- a/projects/bitmap-raw/BitmapGenerator.cs +++ b/projects/bitmap-raw/BitmapGenerator.cs @@ -89,4 +89,21 @@ public static byte[] RandomRectangles(int width = 400, int height = 300) return bmp.GetBitmapBytes(); } + + public static byte[] Ramps(int width = 401, int height = 307) + { + RawBitmap bmp = new(width, height); + + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + byte value = (byte)((x % 10) * 25); + RawColor color = RawColor.Gray(value++); + bmp.SetPixel(x, y, color); + } + } + + return bmp.GetBitmapBytes(); + } } diff --git a/projects/bitmap-raw/Program.cs b/projects/bitmap-raw/Program.cs index b275896..2989a27 100644 --- a/projects/bitmap-raw/Program.cs +++ b/projects/bitmap-raw/Program.cs @@ -6,6 +6,7 @@ SaveBitmapBytes(BitmapGenerator.RandomGrayscale(), "random-grayscale.jpg"); SaveBitmapBytes(BitmapGenerator.RandomRGB(), "random-rgb.jpg"); SaveBitmapBytes(BitmapGenerator.RandomRectangles(), "rectangles.jpg"); +SaveBitmapBytes(BitmapGenerator.Ramps(), "ramps.jpg"); static void SaveBitmapBytes(byte[] bytes, string filename) {