mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Workshop - Add --alt-login-callback startup argument
UI - Rounded corners on profile icons
This commit is contained in:
1 parent
06c5294e88
commit
5609065974
7 files changed
+59
-32
No files matched your search
@@ -6,7 +6,6 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Threading;
|
||||
@@ -43,7 +42,7 @@ public partial class ProfileConfigurationIcon : UserControl, IDisposable
|
||||
if (ConfigurationIcon.IconType == ProfileConfigurationIconType.MaterialIcon)
|
||||
{
|
||||
Content = Enum.TryParse(ConfigurationIcon.IconName, true, out MaterialIconKind parsedIcon)
|
||||
? new MaterialIcon {Kind = parsedIcon!}
|
||||
? new MaterialIcon {Kind = parsedIcon}
|
||||
: new MaterialIcon {Kind = MaterialIconKind.QuestionMark};
|
||||
}
|
||||
else if (ConfigurationIcon.IconBytes != null)
|
||||
@@ -65,19 +64,28 @@ public partial class ProfileConfigurationIcon : UserControl, IDisposable
|
||||
return;
|
||||
|
||||
_stream = new MemoryStream(ConfigurationIcon.IconBytes);
|
||||
if (!ConfigurationIcon.Fill)
|
||||
Border border = new()
|
||||
{
|
||||
Content = new Image {Source = new Bitmap(_stream)};
|
||||
return;
|
||||
CornerRadius = CornerRadius,
|
||||
ClipToBounds = true,
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch
|
||||
|
||||
};
|
||||
|
||||
if (ConfigurationIcon.Fill)
|
||||
{
|
||||
// Fill mode: use Foreground as Background and the bitmap as opacity mask
|
||||
border.Background = TextElement.GetForeground(this);
|
||||
border.OpacityMask = new ImageBrush(new Bitmap(_stream));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-fill mode: place the image inside the rounded border
|
||||
border.Child = new Image { Source = new Bitmap(_stream) };
|
||||
}
|
||||
|
||||
Content = new Border
|
||||
{
|
||||
Background = TextElement.GetForeground(this),
|
||||
VerticalAlignment = VerticalAlignment.Stretch,
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
OpacityMask = new ImageBrush(new Bitmap(_stream))
|
||||
};
|
||||
Content = border;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user