f in da chats for da floating point mode now killing all da others

This commit is contained in:
AUnicornWithNoLife 2023-01-10 10:15:05 +00:00
parent 8568de28ed
commit e871286cd1

View File

@ -30,13 +30,15 @@ namespace Cupola
Console.WriteLine("mode?");
if (Console.ReadKey().Key == ConsoleKey.S)
ConsoleKey keyGG = Console.ReadKey().Key;
if (keyGG == ConsoleKey.S)
{
Bitmap final = await Combine(images.ToArray(), 0.6f);
final.Save(name + ".png");
}
else
else if (keyGG == ConsoleKey.M)
{
Dictionary<string, Task<Bitmap>> log = new Dictionary<string, Task<Bitmap>>();
@ -56,6 +58,19 @@ namespace Cupola
img.Save(logItem.Key);
}
}
else if (keyGG == ConsoleKey.F)
{
FloatImage[] fImages = new FloatImage[images.Count];
for (int i = 0; i < images.Count; i++)
{
fImages[i] = new FloatImage(images[i]);
}
Bitmap final = FloatImage.Blend(fImages, true).ToBitmap();
final.Save(name + ".png");
}
}
public static async Task<Bitmap> Combine(Bitmap[] images, float oldWeight = 1f) // default to brightest
@ -198,7 +213,7 @@ namespace Cupola
green = (byte)Math.Clamp((int)this.green, 0, 256);
blue = (byte)Math.Clamp((int)this.blue, 0, 256);
return Color.FromArgb(0, red, green, blue);
return Color.FromArgb(red, green, blue);
}
public static void Spread(FloatColor[] colors, ref float minus, ref float multiply)
@ -323,9 +338,12 @@ namespace Cupola
pixel.blue += pixTemp.blue;
}
if (!spread)
{
pixel.red = pixel.red / images.Length;
pixel.green = pixel.green / images.Length;
pixel.blue = pixel.blue / images.Length;
}
output.SetPixel(x, y, pixel);
}