Pārlūkot izejas kodu

Remove darkening filter from Splashscreen
Using the foregroundLayer parameter has the same effect

David Ullmer 3 gadi atpakaļ
vecāks
revīzija
68db3be0e7

+ 3 - 6
Jellyfin.Api/Controllers/ImageController.cs

@@ -1717,7 +1717,6 @@ namespace Jellyfin.Api.Controllers
         /// <param name="blur">Optional. Blur image.</param>
         /// <param name="blur">Optional. Blur image.</param>
         /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param>
         /// <param name="backgroundColor">Optional. Apply a background color for transparent images.</param>
         /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param>
         /// <param name="foregroundLayer">Optional. Apply a foreground layer on top of the image.</param>
-        /// <param name="darken">Darken the generated image.</param>
         /// <response code="200">Splashscreen returned successfully.</response>
         /// <response code="200">Splashscreen returned successfully.</response>
         /// <returns>The splashscreen.</returns>
         /// <returns>The splashscreen.</returns>
         [HttpGet("Branding/Splashscreen")]
         [HttpGet("Branding/Splashscreen")]
@@ -1735,8 +1734,7 @@ namespace Jellyfin.Api.Controllers
             [FromQuery] int? fillHeight,
             [FromQuery] int? fillHeight,
             [FromQuery] int? blur,
             [FromQuery] int? blur,
             [FromQuery] string? backgroundColor,
             [FromQuery] string? backgroundColor,
-            [FromQuery] string? foregroundLayer,
-            [FromQuery] bool? darken = false)
+            [FromQuery] string? foregroundLayer)
         {
         {
             string splashscreenPath;
             string splashscreenPath;
             var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
             var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
@@ -1746,12 +1744,11 @@ namespace Jellyfin.Api.Controllers
             }
             }
             else
             else
             {
             {
-                var filename = darken!.Value ? "splashscreen-darken.webp" : "splashscreen.webp";
-                splashscreenPath = Path.Combine(_appPaths.DataPath, filename);
+                splashscreenPath = Path.Combine(_appPaths.DataPath, "splashscreen.webp");
 
 
                 if (!System.IO.File.Exists(splashscreenPath) && _imageGenerator.GetSupportedImages().Contains(GeneratedImages.Splashscreen))
                 if (!System.IO.File.Exists(splashscreenPath) && _imageGenerator.GetSupportedImages().Contains(GeneratedImages.Splashscreen))
                 {
                 {
-                    _imageGenerator.GenerateSplashscreen(new SplashscreenOptions(splashscreenPath, darken.Value));
+                    _imageGenerator.GenerateSplashscreen(splashscreenPath);
                 }
                 }
             }
             }
 
 

+ 2 - 2
Jellyfin.Drawing.Skia/DefaultImageGenerator.cs

@@ -44,7 +44,7 @@ namespace Jellyfin.Drawing.Skia
         }
         }
 
 
         /// <inheritdoc/>
         /// <inheritdoc/>
-        public void GenerateSplashscreen(SplashscreenOptions generationOptions)
+        public void GenerateSplashscreen(string outputPath)
         {
         {
             var posters = GetItemsWithImageType(ImageType.Primary).Select(x => x.GetImages(ImageType.Primary).First().Path).ToList();
             var posters = GetItemsWithImageType(ImageType.Primary).Select(x => x.GetImages(ImageType.Primary).First().Path).ToList();
             var landscape = GetItemsWithImageType(ImageType.Thumb).Select(x => x.GetImages(ImageType.Thumb).First().Path).ToList();
             var landscape = GetItemsWithImageType(ImageType.Thumb).Select(x => x.GetImages(ImageType.Thumb).First().Path).ToList();
@@ -57,7 +57,7 @@ namespace Jellyfin.Drawing.Skia
             }
             }
 
 
             var splashBuilder = new SplashscreenBuilder((SkiaEncoder)_imageEncoder);
             var splashBuilder = new SplashscreenBuilder((SkiaEncoder)_imageEncoder);
-            splashBuilder.GenerateSplash(posters, landscape, generationOptions.OutputPath, generationOptions.ApplyFilter);
+            splashBuilder.GenerateSplash(posters, landscape, outputPath);
         }
         }
 
 
         private IReadOnlyList<BaseItem> GetItemsWithImageType(ImageType imageType)
         private IReadOnlyList<BaseItem> GetItemsWithImageType(ImageType imageType)

+ 3 - 15
Jellyfin.Drawing.Skia/SplashscreenBuilder.cs

@@ -36,10 +36,9 @@ namespace Jellyfin.Drawing.Skia
         /// <param name="posters">The poster paths.</param>
         /// <param name="posters">The poster paths.</param>
         /// <param name="backdrop">The landscape paths.</param>
         /// <param name="backdrop">The landscape paths.</param>
         /// <param name="outputPath">The output path.</param>
         /// <param name="outputPath">The output path.</param>
-        /// <param name="applyFilter">Whether to apply the darkening filter.</param>
-        public void GenerateSplash(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop, string outputPath, bool applyFilter)
+        public void GenerateSplash(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop, string outputPath)
         {
         {
-            var wall = GenerateCollage(posters, backdrop, applyFilter);
+            var wall = GenerateCollage(posters, backdrop);
             var transformed = Transform3D(wall);
             var transformed = Transform3D(wall);
 
 
             using var outputStream = new SKFileWStream(outputPath);
             using var outputStream = new SKFileWStream(outputPath);
@@ -52,9 +51,8 @@ namespace Jellyfin.Drawing.Skia
         /// </summary>
         /// </summary>
         /// <param name="posters">The poster paths.</param>
         /// <param name="posters">The poster paths.</param>
         /// <param name="backdrop">The landscape paths.</param>
         /// <param name="backdrop">The landscape paths.</param>
-        /// <param name="applyFilter">Whether to apply the darkening filter.</param>
         /// <returns>The created collage as a bitmap.</returns>
         /// <returns>The created collage as a bitmap.</returns>
-        private SKBitmap GenerateCollage(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop, bool applyFilter)
+        private SKBitmap GenerateCollage(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop)
         {
         {
             _random = new Random();
             _random = new Random();
 
 
@@ -119,16 +117,6 @@ namespace Jellyfin.Drawing.Skia
                 }
                 }
             }
             }
 
 
-            if (applyFilter)
-            {
-                var paintColor = new SKPaint
-                {
-                    Color = SKColors.Black.WithAlpha(0x50),
-                    Style = SKPaintStyle.Fill
-                };
-                canvas.DrawRect(0, 0, WallWidth, WallHeight, paintColor);
-            }
-
             return bitmap;
             return bitmap;
         }
         }
 
 

+ 2 - 2
MediaBrowser.Controller/Drawing/IImageGenerator.cs

@@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Drawing
         /// <summary>
         /// <summary>
         /// Generates a splashscreen.
         /// Generates a splashscreen.
         /// </summary>
         /// </summary>
-        /// <param name="generationOptions">The options used to generate the splashscreen.</param>
-        void GenerateSplashscreen(SplashscreenOptions generationOptions);
+        /// <param name="outputPath">The path where the splashscreen should be saved.</param>
+        void GenerateSplashscreen(string outputPath);
     }
     }
 }
 }

+ 0 - 29
MediaBrowser.Controller/Drawing/SplashscreenOptions.cs

@@ -1,29 +0,0 @@
-namespace MediaBrowser.Controller.Drawing
-{
-    /// <summary>
-    /// Options used to generate the splashscreen.
-    /// </summary>
-    public class SplashscreenOptions
-    {
-        /// <summary>
-        /// Initializes a new instance of the <see cref="SplashscreenOptions"/> class.
-        /// </summary>
-        /// <param name="outputPath">The output path.</param>
-        /// <param name="applyFilter">Optional. Apply a darkening filter.</param>
-        public SplashscreenOptions(string outputPath, bool applyFilter = false)
-        {
-            OutputPath = outputPath;
-            ApplyFilter = applyFilter;
-        }
-
-        /// <summary>
-        /// Gets or sets the output path.
-        /// </summary>
-        public string OutputPath { get; set; }
-
-        /// <summary>
-        /// Gets or sets a value indicating whether to apply a darkening filter at the end.
-        /// </summary>
-        public bool ApplyFilter { get; set; }
-    }
-}