diff --git a/FModel/Creator/BaseOffer.cs b/FModel/Creator/BaseOffer.cs index 310ddf94..f9715cce 100644 --- a/FModel/Creator/BaseOffer.cs +++ b/FModel/Creator/BaseOffer.cs @@ -26,27 +26,42 @@ namespace FModel.Creator public BaseOffer(IUExport export) : this() { - if (export.TryGetValue("DetailsImage", out var v1) && v1 is StructProperty s && - s.Value is UObject typeImage && typeImage.TryGetValue("ResourceObject", out var v2) && v2 is ObjectProperty resourceObject) + if (export.GetExport("DetailsImage", "TileImage") is StructProperty typeImage) { - IconImage = Utils.GetObjectTexture(resourceObject); - } - - if (export.TryGetValue("Gradient", out var g) && g is StructProperty r && r.Value is UObject gradient) - { - if (gradient.TryGetValue("Start", out var s1) && s1 is StructProperty t1 && t1.Value is FLinearColor start && - gradient.TryGetValue("Stop", out var s2) && s2 is StructProperty t2 && t2.Value is FLinearColor stop) + if (typeImage.Value is UObject t && t.TryGetValue("ResourceObject", out var v) && v is ObjectProperty resourceObject) { - RarityBackgroundColors = new SKColor[2] { SKColor.Parse(stop.Hex), SKColor.Parse(start.Hex) }; + IconImage = Utils.GetObjectTexture(resourceObject); } } - if (export.TryGetValue("Background", out var b) && b is StructProperty a && a.Value is FLinearColor background) - RarityBorderColor = SKColor.Parse(background.Hex); + if (export.GetExport("Gradient") is StructProperty gradient) + { + if (gradient.Value is UObject g && + g.TryGetValue("Start", out var s1) && s1 is StructProperty t1 && t1.Value is FLinearColor start && + g.TryGetValue("Stop", out var s2) && s2 is StructProperty t2 && t2.Value is FLinearColor stop) + { + RarityBackgroundColors = new SKColor[2] { SKColor.Parse(start.Hex), SKColor.Parse(stop.Hex) }; + } + } + + if (export.GetExport("Background") is StructProperty background) + { + if (background.Value is FLinearColor b) + { + RarityBorderColor = SKColor.Parse(b.Hex); + } + } } - public void Draw(SKCanvas c) + public void DrawBackground(SKCanvas c) { + if (RarityBackgroundColors[0] == RarityBackgroundColors[1]) + RarityBackgroundColors[0] = RarityBorderColor; + + RarityBackgroundColors[0].ToHsl(out var _, out var _, out var l1); + RarityBackgroundColors[1].ToHsl(out var _, out var _, out var l2); + bool reverse = l1 > l2; + // border c.DrawRect(new SKRect(0, 0, Size, Size), new SKPaint @@ -64,10 +79,13 @@ namespace FModel.Creator Shader = SKShader.CreateRadialGradient( new SKPoint(Size / 2, Size / 2), Size / 5 * 4, - RarityBackgroundColors, + new SKColor[2] { reverse ? RarityBackgroundColors[0] : RarityBackgroundColors[1], reverse ? RarityBackgroundColors[1] : RarityBackgroundColors[0] }, SKShaderTileMode.Clamp) }); + } + public void DrawImage(SKCanvas c) + { c.DrawBitmap(IconImage ?? FallbackImage, new SKRect(Margin, Margin, Size - Margin, Size - Margin), new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true }); } diff --git a/FModel/Creator/Creator.cs b/FModel/Creator/Creator.cs index 80f0d1d2..bc80e516 100644 --- a/FModel/Creator/Creator.cs +++ b/FModel/Creator/Creator.cs @@ -92,29 +92,37 @@ namespace FModel.Creator { BaseIcon icon = new BaseIcon(export, exportType, ref assetName); int height = icon.Size + icon.AdditionalSize; - using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Opaque)) + using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { - Rarity.DrawRarity(c, icon); - LargeSmallImage.DrawPreviewImage(c, icon); - if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText) + if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) { - Text.DrawBackground(c, icon); - Text.DrawDisplayName(c, icon); - Text.DrawDescription(c, icon); - if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini) - { - if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description)) - Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription); - Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource); - } + Rarity.DrawRarity(c, icon); } - UserFacingFlag.DrawUserFacingFlags(c, icon); - // has more things to show - if (height > icon.Size) + LargeSmallImage.DrawPreviewImage(c, icon); + + if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) { - Statistics.DrawStats(c, icon); + if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText) + { + Text.DrawBackground(c, icon); + Text.DrawDisplayName(c, icon); + Text.DrawDescription(c, icon); + if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini) + { + if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description)) + Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription); + Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource); + } + } + UserFacingFlag.DrawUserFacingFlags(c, icon); + + // has more things to show + if (height > icon.Size) + { + Statistics.DrawStats(c, icon); + } } Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 @@ -125,10 +133,14 @@ namespace FModel.Creator case "FortMtxOfferData": { BaseOffer icon = new BaseOffer(export); - using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque)) + using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { - icon.Draw(c); + if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) + { + icon.DrawBackground(c); + } + icon.DrawImage(c); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); diff --git a/FModel/Enums.cs b/FModel/Enums.cs index df3f28b8..a1e7874c 100644 --- a/FModel/Enums.cs +++ b/FModel/Enums.cs @@ -54,6 +54,7 @@ public enum EIconDesign : long { Default, + NoBackground, NoText, Mini, Flat diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 169c4db3..5fb15c6a 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -8,8 +8,8 @@ FModel.App Asval - 3.1.0.3 - 3.1.0.3 + 3.1.0.4 + 3.1.0.4 FModel.ico https://github.com/iAmAsval/FModel @@ -53,6 +53,7 @@ + @@ -122,7 +123,7 @@ - + @@ -156,6 +157,7 @@ + diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs index 0cf8fe74..1cc57d07 100644 --- a/FModel/Properties/Resources.Designer.cs +++ b/FModel/Properties/Resources.Designer.cs @@ -881,6 +881,16 @@ namespace FModel.Properties { } } + /// + /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap EIconDesign_NoBackground { + get { + object obj = ResourceManager.GetObject("EIconDesign_NoBackground", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Recherche une ressource localisée de type System.Drawing.Bitmap. /// @@ -1766,6 +1776,15 @@ namespace FModel.Properties { } } + /// + /// Recherche une chaîne localisée semblable à No Background. + /// + public static string NoBackground { + get { + return ResourceManager.GetString("NoBackground", resourceCulture); + } + } + /// /// Recherche une chaîne localisée semblable à There are currently no data to export. /// diff --git a/FModel/Properties/Resources.ar.resx b/FModel/Properties/Resources.ar.resx index 3756e4e6..c6e6f63e 100644 --- a/FModel/Properties/Resources.ar.resx +++ b/FModel/Properties/Resources.ar.resx @@ -820,4 +820,7 @@ It's now the most used free software to leak on Fortnite. استخدم Fmodel باللغة الإنجليزية + + أي خلفية + \ No newline at end of file diff --git a/FModel/Properties/Resources.de-DE.resx b/FModel/Properties/Resources.de-DE.resx index b7671af9..a1f01d70 100644 --- a/FModel/Properties/Resources.de-DE.resx +++ b/FModel/Properties/Resources.de-DE.resx @@ -855,4 +855,7 @@ Jetzt ist es die am häufigsten genutzte freie Software um mit Fortnite zu leake FModel in Englisch benutzen + + Kein Hintergrund + \ No newline at end of file diff --git a/FModel/Properties/Resources.fr-FR.resx b/FModel/Properties/Resources.fr-FR.resx index 3ec046df..e2c9a8d1 100644 --- a/FModel/Properties/Resources.fr-FR.resx +++ b/FModel/Properties/Resources.fr-FR.resx @@ -862,4 +862,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite. Utiliser FModel en Anglais + + Pas de fond + \ No newline at end of file diff --git a/FModel/Properties/Resources.it-IT.resx b/FModel/Properties/Resources.it-IT.resx index c7159f6b..d3ce5585 100644 --- a/FModel/Properties/Resources.it-IT.resx +++ b/FModel/Properties/Resources.it-IT.resx @@ -820,4 +820,7 @@ Col tempo sono state aggiunte nuove funzioni e molti altri utenti hanno comincia Al momento non ci sono immagini da copiare + + Nessuno Sfondo + \ No newline at end of file diff --git a/FModel/Properties/Resources.resx b/FModel/Properties/Resources.resx index a0116ac1..b43ec0bb 100644 --- a/FModel/Properties/Resources.resx +++ b/FModel/Properties/Resources.resx @@ -1098,4 +1098,10 @@ It's now the most used free software to leak on Fortnite. Use FModel in English + + No Background + + + ..\Resources\EIconDesign_NoBackground.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/FModel/Resources/EIconDesign_NoBackground.png b/FModel/Resources/EIconDesign_NoBackground.png new file mode 100644 index 00000000..f9209eff Binary files /dev/null and b/FModel/Resources/EIconDesign_NoBackground.png differ diff --git a/FModel/ViewModels/ComboBox/ComboBoxViewModel.cs b/FModel/ViewModels/ComboBox/ComboBoxViewModel.cs index 2dca0b20..26c954fa 100644 --- a/FModel/ViewModels/ComboBox/ComboBoxViewModel.cs +++ b/FModel/ViewModels/ComboBox/ComboBoxViewModel.cs @@ -26,9 +26,10 @@ namespace FModel.ViewModels.ComboBox public static ObservableCollection designCbViewModel = new ObservableCollection { new ComboBoxViewModel { Id = 0, Content = Properties.Resources.Default, Property = EIconDesign.Default }, - new ComboBoxViewModel { Id = 1, Content = Properties.Resources.NoText, Property = EIconDesign.NoText }, - new ComboBoxViewModel { Id = 2, Content = Properties.Resources.Minimalist, Property = EIconDesign.Mini }, - new ComboBoxViewModel { Id = 3, Content = Properties.Resources.Flat, Property = EIconDesign.Flat } + new ComboBoxViewModel { Id = 1, Content = Properties.Resources.NoBackground, Property = EIconDesign.NoBackground }, + new ComboBoxViewModel { Id = 2, Content = Properties.Resources.NoText, Property = EIconDesign.NoText }, + new ComboBoxViewModel { Id = 3, Content = Properties.Resources.Minimalist, Property = EIconDesign.Mini }, + new ComboBoxViewModel { Id = 4, Content = Properties.Resources.Flat, Property = EIconDesign.Flat } }; public static ObservableCollection gamesCbViewModel = new ObservableCollection(); diff --git a/FModel/Windows/Settings/IconCreator.xaml.cs b/FModel/Windows/Settings/IconCreator.xaml.cs index d13a26f6..c9702fa9 100644 --- a/FModel/Windows/Settings/IconCreator.xaml.cs +++ b/FModel/Windows/Settings/IconCreator.xaml.cs @@ -129,7 +129,7 @@ namespace FModel.Windows.Settings if (Designs_CbBox.HasItems && Designs_CbBox.SelectedIndex >= 0 && Designs_CbBox.SelectedItem is ComboBoxViewModel selectedItem) { using SKBitmap rarityBase = SKBitmap.Decode(Application.GetResourceStream(new Uri($"pack://application:,,,/Resources/EIconDesign_{(EIconDesign)selectedItem.Property}.png")).Stream); - using var ret = new SKBitmap(512, 512, SKColorType.Rgba8888, SKAlphaType.Opaque); + using var ret = new SKBitmap(512, 512, SKColorType.Rgba8888, SKAlphaType.Premul); using var c = new SKCanvas(ret); c.DrawBitmap(rarityBase, new SKRect(0, 0, 512, 512), new SKPaint { FilterQuality = SKFilterQuality.High, IsAntialias = true });