From 83f7722cacde388a94a7c25a44da79f4a03eb92a Mon Sep 17 00:00:00 2001 From: AUnicornWithNoLife Date: Wed, 11 Jan 2023 11:40:46 +0000 Subject: [PATCH] height --- Program.cs | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 90e2b1b..df61894 100644 --- a/Program.cs +++ b/Program.cs @@ -1,6 +1,4 @@ -using System; -using System.Drawing; -using System.IO; +using System.Drawing; namespace Cupola { @@ -216,6 +214,11 @@ namespace Cupola return Color.FromArgb(red, green, blue); } + public float Brightness() + { + return this.red + this.green + this.blue; + } + public static void Spread(FloatColor[] colors, ref float minus, ref float multiply) { List allColors = new List(); @@ -344,7 +347,7 @@ namespace Cupola pixel.green = pixel.green / images.Length; pixel.blue = pixel.blue / images.Length; } - + output.SetPixel(x, y, pixel); } } @@ -373,6 +376,31 @@ namespace Cupola return output; } + + public static FloatImage Highest(FloatImage[] images) + { + FloatImage output = new FloatImage(images[0].width, images[0].height); + + for (int x = 0; x < images[0].width; x++) + { + for (int y = 0; y < images[0].height; y++) + { + FloatColor brightest = new FloatColor(Color.Black); + + for (int i = 0; i < images.Length) + { + if (images[i].pixels[x, y].Brightness() > brightest.Brightness()) + { + brightest = images[i].pixels[x, y]; + } + } + + output.SetPixel(x, y, brightest); + } + } + + return output; + } } } } \ No newline at end of file