mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Remove darkening filter from Splashscreen
Using the foregroundLayer parameter has the same effect
This commit is contained in:
parent
e026ba84c5
commit
68db3be0e7
@ -1717,7 +1717,6 @@ namespace Jellyfin.Api.Controllers
|
||||
/// <param name="blur">Optional. Blur image.</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="darken">Darken the generated image.</param>
|
||||
/// <response code="200">Splashscreen returned successfully.</response>
|
||||
/// <returns>The splashscreen.</returns>
|
||||
[HttpGet("Branding/Splashscreen")]
|
||||
@ -1735,8 +1734,7 @@ namespace Jellyfin.Api.Controllers
|
||||
[FromQuery] int? fillHeight,
|
||||
[FromQuery] int? blur,
|
||||
[FromQuery] string? backgroundColor,
|
||||
[FromQuery] string? foregroundLayer,
|
||||
[FromQuery] bool? darken = false)
|
||||
[FromQuery] string? foregroundLayer)
|
||||
{
|
||||
string splashscreenPath;
|
||||
var brandingOptions = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
|
||||
@ -1746,12 +1744,11 @@ namespace Jellyfin.Api.Controllers
|
||||
}
|
||||
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))
|
||||
{
|
||||
_imageGenerator.GenerateSplashscreen(new SplashscreenOptions(splashscreenPath, darken.Value));
|
||||
_imageGenerator.GenerateSplashscreen(splashscreenPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace Jellyfin.Drawing.Skia
|
||||
}
|
||||
|
||||
/// <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 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);
|
||||
splashBuilder.GenerateSplash(posters, landscape, generationOptions.OutputPath, generationOptions.ApplyFilter);
|
||||
splashBuilder.GenerateSplash(posters, landscape, outputPath);
|
||||
}
|
||||
|
||||
private IReadOnlyList<BaseItem> GetItemsWithImageType(ImageType imageType)
|
||||
|
@ -36,10 +36,9 @@ namespace Jellyfin.Drawing.Skia
|
||||
/// <param name="posters">The poster paths.</param>
|
||||
/// <param name="backdrop">The landscape paths.</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);
|
||||
|
||||
using var outputStream = new SKFileWStream(outputPath);
|
||||
@ -52,9 +51,8 @@ namespace Jellyfin.Drawing.Skia
|
||||
/// </summary>
|
||||
/// <param name="posters">The poster 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>
|
||||
private SKBitmap GenerateCollage(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop, bool applyFilter)
|
||||
private SKBitmap GenerateCollage(IReadOnlyList<string> posters, IReadOnlyList<string> backdrop)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// <summary>
|
||||
/// Generates a splashscreen.
|
||||
/// </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);
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user