make icon size a variable

This commit is contained in:
Colin McMillen 2023-07-26 11:11:06 -04:00
parent c7ff5ee15d
commit a67912e1ce

View File

@ -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<Rgba32> image = MakeImage(64, 64);
Image<Rgba32> 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 };
}