From a67912e1ce1af044364e65d27d946611b5824a17 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Wed, 26 Jul 2023 11:11:06 -0400 Subject: [PATCH] make icon size a variable --- Program.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Program.cs b/Program.cs index 7b6aeaf..8281025 100644 --- a/Program.cs +++ b/Program.cs @@ -505,14 +505,16 @@ public static class Util { } public static OpenTK.Windowing.Common.Input.Image[] RenderAppIcon() { - Font font = SystemFonts.CreateFont("MS PMincho", 64, FontStyle.Bold); + int size = 64; + Font font = SystemFonts.CreateFont("MS PMincho", size, FontStyle.Bold); TextOptions options = new(font); - Image image = MakeImage(64, 64); + Image image = MakeImage(size, size); IBrush brush = Brushes.Solid(Color.Black); image.Mutate(x => x.DrawText(options, "撮", brush)); - byte[] pixelBytes = new byte[64 * 64 * 4]; + byte[] pixelBytes = new byte[size * size * 4]; image.CopyPixelDataTo(pixelBytes); - OpenTK.Windowing.Common.Input.Image opentkImage = new(64, 64, pixelBytes); + image.Dispose(); + OpenTK.Windowing.Common.Input.Image opentkImage = new(size, size, pixelBytes); return new OpenTK.Windowing.Common.Input.Image[]{ opentkImage }; }