diff --git a/src/Ryujinx/Common/Models/ApplicationIcon.cs b/src/Ryujinx/Common/Models/ApplicationIcon.cs index aa53d7e7d..95e0fb07f 100644 --- a/src/Ryujinx/Common/Models/ApplicationIcon.cs +++ b/src/Ryujinx/Common/Models/ApplicationIcon.cs @@ -1,3 +1,6 @@ +using Avalonia.Media.Imaging; +using Ryujinx.Ava.UI.Controls; + namespace Ryujinx.Ava.Common.Models { public class ApplicationIcon @@ -8,5 +11,13 @@ namespace Ryujinx.Ava.Common.Models { get => $"Ryujinx/Assets/Icons/AppIcons/{Filename}"; } + + public Bitmap Icon + { + get + { + return RyujinxLogo.GetBitmapForLogo(this); + } + } } } \ No newline at end of file diff --git a/src/Ryujinx/UI/Controls/RyujinxLogo.cs b/src/Ryujinx/UI/Controls/RyujinxLogo.cs index 4d4733fd6..2f555a93d 100644 --- a/src/Ryujinx/UI/Controls/RyujinxLogo.cs +++ b/src/Ryujinx/UI/Controls/RyujinxLogo.cs @@ -60,15 +60,10 @@ namespace Ryujinx.Ava.UI.Controls Stream activeIconStream = EmbeddedResources.GetStream(selectedIcon.FullPath); if (activeIconStream != null) { - // SVG files need to be converted to an image first - if (selectedIcon.FullPath.EndsWith(".svg", StringComparison.OrdinalIgnoreCase)) + Bitmap logoBitmap = GetBitmapForLogo(selectedIcon); + if (logoBitmap != null) { - Stream pngStream = ConvertSvgToPng(activeIconStream); - CurrentLogoBitmap.Value = new Bitmap(pngStream); - } - else - { - CurrentLogoBitmap.Value = new Bitmap(activeIconStream); + CurrentLogoBitmap.Value = logoBitmap; } } } @@ -82,6 +77,24 @@ namespace Ryujinx.Ava.UI.Controls private void WindowIconChanged_Event(object _, ReactiveEventArgs rArgs) => SetNewAppIcon(rArgs.NewValue); + public static Bitmap GetBitmapForLogo(ApplicationIcon icon) + { + Stream activeIconStream = EmbeddedResources.GetStream(icon.FullPath); + if (activeIconStream == null) + return null; + + // SVG files need to be converted to an image first + if (icon.FullPath.EndsWith(".svg", StringComparison.OrdinalIgnoreCase)) + { + Stream pngStream = ConvertSvgToPng(activeIconStream); + return new Bitmap(pngStream); + } + else + { + return new Bitmap(activeIconStream); + } + } + private static Stream ConvertSvgToPng(Stream svgStream) { int width = 256; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml index 6f3f77d88..7bb41fd2d 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml @@ -173,7 +173,10 @@ SelectedIndex="{Binding AppIconSelectedIndex}"> - + + + +