This commit is contained in:
AUnicornWithNoLife 2022-11-15 11:50:42 +00:00 committed by GitHub
parent 44ae771292
commit 03af4eb688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 612 additions and 0 deletions

14
Cupola.csproj Normal file
View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
</ItemGroup>
</Project>

25
Cupola.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cupola", "Cupola.csproj", "{83EBE364-D0B0-4262-8AFC-539506D72116}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83EBE364-D0B0-4262-8AFC-539506D72116}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83EBE364-D0B0-4262-8AFC-539506D72116}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AD483A57-321A-4AD6-A68F-038CC1DB8066}
EndGlobalSection
EndGlobal

135
Program.cs Normal file
View File

@ -0,0 +1,135 @@
using System;
using System.Drawing;
using System.IO;
namespace Cupola
{
internal class Program
{
static async Task Main(string[] args)
{
List<Bitmap> images = new List<Bitmap>();
Console.WriteLine("Image Dir?");
string fileLoc = Console.ReadLine();
if (fileLoc == null)
throw new ArgumentException("input should not be NULL");
string[] files = Directory.GetFiles(fileLoc);
for (int i = 0; i < files.Length; i++)
{
Console.WriteLine(files[i]);
images.Add(new Bitmap(files[i]));
}
Console.WriteLine("Output: ");
string name = Console.ReadLine();
Console.WriteLine("mode?");
if (Console.ReadKey().Key == ConsoleKey.S)
{
Bitmap bout = await Combine(images.ToArray());
bout.Save(name + ".png");
}
else
{
Bitmap previousBit = images[0];
for (int i = 1; i < images.Count; i++)
{
previousBit.Save(name + (i - 1).ToString());
Console.WriteLine(i.ToString());
previousBit = await Combine(new Bitmap[] { previousBit, images[i] });
}
}
}
public static async Task<Bitmap> Combine(Bitmap[] images)
{
int width = images[0].Width;
int height = images[0].Height;
for (int i = 0; i < images.Length; i++)
{
if (images[i].Width != width || images[i].Height != height)
throw new ArgumentException("images not same size");
}
Bitmap final = new Bitmap(width, height);
Task<Color>[,] result = new Task<Color>[width, height];
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
Color[] potentialColors = new Color[images.Length];
for (int i = 0; i < potentialColors.Length; i++)
potentialColors[i] = images[i].GetPixel(x, y);
result[x, y] = GetBrighter(potentialColors);
}
}
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
final.SetPixel(x, y, await result[x, y]);
}
}
return final;
}
public static async Task<Color> GetBrighter(Color[] colors)
{
Color brightest = new Color();
int brightestScore = 0;
for (int i = 0; i < colors.Length; i++)
{
if (ColorToInt(colors[i]) > brightestScore)
{
brightest = colors[i];
brightestScore = ColorToInt(colors[i]);
}
}
return brightest;
}
public static int ColorToInt(Color color)
{
return color.R + color.B + color.G;
}
public static async Task<Color> GetAverage(Color[] colors)
{
int red = 0;
int green = 0;
int blue = 0;
for (int i = 0; i < colors.Length; i++)
{
red += colors[i].R;
green += colors[i].G;
blue += colors[i].B;
}
return Color.FromArgb(255, red / colors.Length, green / colors.Length, blue / colors.Length);
}
public static async Task<Color> GetBlend(Color color1, Color color2, float weight)
{
return Color.FromArgb(255, (int)(((weight) * color1.R) + ((1 - weight) * color2.R)), (int)(((weight) * color1.G) + ((1 - weight) * color2.G)), (int)(((weight) * color1.B) + ((1 - weight) * color2.B));
}
}
}

View File

@ -0,0 +1,75 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Cupola/1.0.0": {
"dependencies": {
"System.Drawing.Common": "7.0.0"
},
"runtime": {
"Cupola.dll": {}
}
},
"Microsoft.Win32.SystemEvents/7.0.0": {
"runtime": {
"lib/net6.0/Microsoft.Win32.SystemEvents.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
},
"System.Drawing.Common/7.0.0": {
"dependencies": {
"Microsoft.Win32.SystemEvents": "7.0.0"
},
"runtime": {
"lib/net6.0/System.Drawing.Common.dll": {
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/System.Drawing.Common.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "7.0.0.0",
"fileVersion": "7.0.22.51805"
}
}
}
}
},
"libraries": {
"Cupola/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.Win32.SystemEvents/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2nXPrhdAyAzir0gLl8Yy8S5Mnm/uBSQQA7jEsILOS1MTyS7DbmV1NgViMtvV1sfCD1ebITpNwb1NIinKeJgUVQ==",
"path": "microsoft.win32.systemevents/7.0.0",
"hashPath": "microsoft.win32.systemevents.7.0.0.nupkg.sha512"
},
"System.Drawing.Common/7.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-KIX+oBU38pxkKPxvLcLfIkOV5Ien8ReN78wro7OF5/erwcmortzeFx+iBswlh2Vz6gVne0khocQudGwaO1Ey6A==",
"path": "system.drawing.common/7.0.0",
"hashPath": "system.drawing.common.7.0.0.nupkg.sha512"
}
}
}

BIN
bin/Debug/net6.0/Cupola.dll Normal file

Binary file not shown.

BIN
bin/Debug/net6.0/Cupola.exe Normal file

Binary file not shown.

BIN
bin/Debug/net6.0/Cupola.pdb Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,69 @@
{
"format": 1,
"restore": {
"N:\\Visual Studio\\Cupola\\Cupola.csproj": {}
},
"projects": {
"N:\\Visual Studio\\Cupola\\Cupola.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "N:\\Visual Studio\\Cupola\\Cupola.csproj",
"projectName": "Cupola",
"projectPath": "N:\\Visual Studio\\Cupola\\Cupola.csproj",
"packagesPath": "C:\\Users\\bbarratt\\.nuget\\packages\\",
"outputPath": "N:\\Visual Studio\\Cupola\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\bbarratt\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"System.Drawing.Common": {
"target": "Package",
"version": "[7.0.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.401\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\bbarratt\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\bbarratt\.nuget\packages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Cupola")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Cupola")]
[assembly: System.Reflection.AssemblyTitleAttribute("Cupola")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
734ad5c9cd6c8c2ee2a76c081fccb22233a049b2

View File

@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Cupola
build_property.ProjectDir = N:\Visual Studio\Cupola\

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
941f75bc5e60b8aebab62fbd87d7ed12bd64c185

View File

@ -0,0 +1,20 @@
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.csproj.AssemblyReference.cache
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.GeneratedMSBuildEditorConfig.editorconfig
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.AssemblyInfoInputs.cache
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.AssemblyInfo.cs
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.csproj.CoreCompileInputs.cache
N:\Visual Studio\Cupola\bin\Debug\net6.0\Cupola.exe
N:\Visual Studio\Cupola\bin\Debug\net6.0\Cupola.deps.json
N:\Visual Studio\Cupola\bin\Debug\net6.0\Cupola.runtimeconfig.json
N:\Visual Studio\Cupola\bin\Debug\net6.0\Cupola.dll
N:\Visual Studio\Cupola\bin\Debug\net6.0\Cupola.pdb
N:\Visual Studio\Cupola\bin\Debug\net6.0\Microsoft.Win32.SystemEvents.dll
N:\Visual Studio\Cupola\bin\Debug\net6.0\System.Drawing.Common.dll
N:\Visual Studio\Cupola\bin\Debug\net6.0\runtimes\win\lib\net6.0\Microsoft.Win32.SystemEvents.dll
N:\Visual Studio\Cupola\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.csproj.CopyComplete
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.dll
N:\Visual Studio\Cupola\obj\Debug\net6.0\refint\Cupola.dll
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.pdb
N:\Visual Studio\Cupola\obj\Debug\net6.0\Cupola.genruntimeconfig.cache
N:\Visual Studio\Cupola\obj\Debug\net6.0\ref\Cupola.dll

BIN
obj/Debug/net6.0/Cupola.dll Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
cf0e2ed75d3495456bbd8e77df2147a62a6d06dc

BIN
obj/Debug/net6.0/Cupola.pdb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

193
obj/project.assets.json Normal file
View File

@ -0,0 +1,193 @@
{
"version": 3,
"targets": {
"net6.0": {
"Microsoft.Win32.SystemEvents/7.0.0": {
"type": "package",
"compile": {
"lib/net6.0/Microsoft.Win32.SystemEvents.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/Microsoft.Win32.SystemEvents.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.dll": {
"assetType": "runtime",
"rid": "win"
}
}
},
"System.Drawing.Common/7.0.0": {
"type": "package",
"dependencies": {
"Microsoft.Win32.SystemEvents": "7.0.0"
},
"compile": {
"lib/net6.0/System.Drawing.Common.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/System.Drawing.Common.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
},
"runtimeTargets": {
"runtimes/win/lib/net6.0/System.Drawing.Common.dll": {
"assetType": "runtime",
"rid": "win"
}
}
}
}
},
"libraries": {
"Microsoft.Win32.SystemEvents/7.0.0": {
"sha512": "2nXPrhdAyAzir0gLl8Yy8S5Mnm/uBSQQA7jEsILOS1MTyS7DbmV1NgViMtvV1sfCD1ebITpNwb1NIinKeJgUVQ==",
"type": "package",
"path": "microsoft.win32.systemevents/7.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net461/Microsoft.Win32.SystemEvents.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/Microsoft.Win32.SystemEvents.targets",
"lib/net462/Microsoft.Win32.SystemEvents.dll",
"lib/net462/Microsoft.Win32.SystemEvents.xml",
"lib/net6.0/Microsoft.Win32.SystemEvents.dll",
"lib/net6.0/Microsoft.Win32.SystemEvents.xml",
"lib/net7.0/Microsoft.Win32.SystemEvents.dll",
"lib/net7.0/Microsoft.Win32.SystemEvents.xml",
"lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll",
"lib/netstandard2.0/Microsoft.Win32.SystemEvents.xml",
"microsoft.win32.systemevents.7.0.0.nupkg.sha512",
"microsoft.win32.systemevents.nuspec",
"runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.dll",
"runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.xml",
"runtimes/win/lib/net7.0/Microsoft.Win32.SystemEvents.dll",
"runtimes/win/lib/net7.0/Microsoft.Win32.SystemEvents.xml",
"useSharedDesignerContext.txt"
]
},
"System.Drawing.Common/7.0.0": {
"sha512": "KIX+oBU38pxkKPxvLcLfIkOV5Ien8ReN78wro7OF5/erwcmortzeFx+iBswlh2Vz6gVne0khocQudGwaO1Ey6A==",
"type": "package",
"path": "system.drawing.common/7.0.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net461/System.Drawing.Common.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/System.Drawing.Common.targets",
"lib/MonoAndroid10/_._",
"lib/MonoTouch10/_._",
"lib/net462/System.Drawing.Common.dll",
"lib/net462/System.Drawing.Common.xml",
"lib/net6.0/System.Drawing.Common.dll",
"lib/net6.0/System.Drawing.Common.xml",
"lib/net7.0/System.Drawing.Common.dll",
"lib/net7.0/System.Drawing.Common.xml",
"lib/netstandard2.0/System.Drawing.Common.dll",
"lib/netstandard2.0/System.Drawing.Common.xml",
"lib/xamarinios10/_._",
"lib/xamarinmac20/_._",
"lib/xamarintvos10/_._",
"lib/xamarinwatchos10/_._",
"runtimes/win/lib/net6.0/System.Drawing.Common.dll",
"runtimes/win/lib/net6.0/System.Drawing.Common.xml",
"runtimes/win/lib/net7.0/System.Drawing.Common.dll",
"runtimes/win/lib/net7.0/System.Drawing.Common.xml",
"system.drawing.common.7.0.0.nupkg.sha512",
"system.drawing.common.nuspec",
"useSharedDesignerContext.txt"
]
}
},
"projectFileDependencyGroups": {
"net6.0": [
"System.Drawing.Common >= 7.0.0"
]
},
"packageFolders": {
"C:\\Users\\bbarratt\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "N:\\Visual Studio\\Cupola\\Cupola.csproj",
"projectName": "Cupola",
"projectPath": "N:\\Visual Studio\\Cupola\\Cupola.csproj",
"packagesPath": "C:\\Users\\bbarratt\\.nuget\\packages\\",
"outputPath": "N:\\Visual Studio\\Cupola\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\bbarratt\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"System.Drawing.Common": {
"target": "Package",
"version": "[7.0.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.401\\RuntimeIdentifierGraph.json"
}
}
}
}

11
obj/project.nuget.cache Normal file
View File

@ -0,0 +1,11 @@
{
"version": 2,
"dgSpecHash": "F70Vtmga3dIBjYTI1+jhHwQbOVeAZDBGMkfkM4cnFznGclBXWRsuSbdRyh9scrFNlgK/txUVpwX4nBQS7+viIg==",
"success": true,
"projectFilePath": "N:\\Visual Studio\\Cupola\\Cupola.csproj",
"expectedPackageFiles": [
"C:\\Users\\bbarratt\\.nuget\\packages\\microsoft.win32.systemevents\\7.0.0\\microsoft.win32.systemevents.7.0.0.nupkg.sha512",
"C:\\Users\\bbarratt\\.nuget\\packages\\system.drawing.common\\7.0.0\\system.drawing.common.7.0.0.nupkg.sha512"
],
"logs": []
}