From 41cfd831b745c6ff2fbbb43bab2c5362e6a706b4 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Mon, 30 Oct 2023 16:19:26 -0300 Subject: [PATCH 1/2] feat: added scale feature to UnoSplashScreen --- .../base.props | 1 + src/Resizetizer/src/ResizeImageInfo.cs | 32 ++++++++++++++++++- src/Resizetizer/src/Resizer.cs | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/samples/NewTemplate/Resizetizer.Extensions.Sample.Base/base.props b/samples/NewTemplate/Resizetizer.Extensions.Sample.Base/base.props index 979f0902..dd75263f 100644 --- a/samples/NewTemplate/Resizetizer.Extensions.Sample.Base/base.props +++ b/samples/NewTemplate/Resizetizer.Extensions.Sample.Base/base.props @@ -17,6 +17,7 @@ diff --git a/src/Resizetizer/src/ResizeImageInfo.cs b/src/Resizetizer/src/ResizeImageInfo.cs index 04d03a37..a3e9de06 100644 --- a/src/Resizetizer/src/ResizeImageInfo.cs +++ b/src/Resizetizer/src/ResizeImageInfo.cs @@ -138,6 +138,12 @@ public static List Parse(IEnumerable? images) info.ForegroundScale = fsc; } + if (info.IsSplashScreen) + { + SetPlatformForegroundScale(image, "Scale", info); + ApplyPlatformScale(image, info); + } + var fgFile = image.GetMetadata("ForegroundFile"); if (!string.IsNullOrEmpty(fgFile)) { @@ -162,6 +168,7 @@ public static List Parse(IEnumerable? images) ApplyPlatformForegroundScale(image, info); } + // TODO: // - Parse out custom DPI's @@ -180,7 +187,6 @@ static void SetPlatformForegroundScale(ITaskItem image, string property, ResizeI } } - static void ApplyPlatformForegroundScale(ITaskItem image, ResizeImageInfo info) { switch (ResizetizeImages_v0.TargetPlatform) @@ -203,5 +209,29 @@ static void ApplyPlatformForegroundScale(ITaskItem image, ResizeImageInfo info) break; } } + + + static void ApplyPlatformScale(ITaskItem image, ResizeImageInfo info) + { + switch (ResizetizeImages_v0.TargetPlatform) + { + case "android": + SetPlatformForegroundScale(image, "AndroidScale", info); + break; + case "ios": + SetPlatformForegroundScale(image, "IOSScale", info); + break; + case "uwp": + SetPlatformForegroundScale(image, "WindowsScale", info); + break; + case "wasm": + SetPlatformForegroundScale(image, "WasmScale", info); + break; + //skia + case "netstandard" or "wpf": + SetPlatformForegroundScale(image, "SkiaScale", info); + break; + } + } } } diff --git a/src/Resizetizer/src/Resizer.cs b/src/Resizetizer/src/Resizer.cs index 87e1d827..ea857a4c 100644 --- a/src/Resizetizer/src/Resizer.cs +++ b/src/Resizetizer/src/Resizer.cs @@ -116,7 +116,7 @@ public ResizedImageInfo Resize(DpiPath dpi, string inputsFile) void Rasterize(DpiPath dpi, string destination) { tools ??= SkiaSharpTools.Create(Info.IsVector, Info.Filename, Info.BaseSize, Info.Color, Info.TintColor, Logger); - tools.Resize(dpi, destination); + tools.Resize(dpi, destination, Info.ForegroundScale); } } } From 667015675b1ab0cd82f2d2a496fab71864fb0b70 Mon Sep 17 00:00:00 2001 From: Pedro Jesus Date: Mon, 30 Oct 2023 16:19:35 -0300 Subject: [PATCH 2/2] docs: added docs for UnoSplashScreen --- doc/uno-resizetizer-properties.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/uno-resizetizer-properties.md b/doc/uno-resizetizer-properties.md index 0227a413..f2334b35 100644 --- a/doc/uno-resizetizer-properties.md +++ b/doc/uno-resizetizer-properties.md @@ -44,10 +44,16 @@ Properties that can be used across all items | Property Name | Description | | ------------- | ----------- | -| Include | Used to insert the path of the image asset, could be a `png` or `svg` | +| Include | Used to insert the path of the image asset, could be a `png` or `svg`. | ## UnoSplashScreen | Property Name | Description | | ------------- | ----------- | -| Include | Used to insert the path of the image asset, could be a `png` or `svg` | \ No newline at end of file +| Include | Used to insert the path of the image asset, could be a `png` or `svg`. | +| Scale | Used to scale the image that will be used as SplashScreen. This property will be override by any platform specific scale. | +| AndroidScale | Used to scale the image that will be used as SplashScreen on Android platform. | +| IOSScale | Used to scale the image that will be used as SplashScreen on iOS platform. | +| WindowsScale | Used to scale the image that will be used as SplashScreen on Windows platform. | +| WasmScale | Used to scale the image that will be used as SplashScreen on Wasm. | +| SkiaScale | Used to scale the image that will be used as SplashScreen on Skia targets (GTK and WPF). | \ No newline at end of file