aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-23 14:48:58 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-23 14:48:58 -0500
commitc7fe8587cbf9e42f195d06aab07a719f991fbb9e (patch)
treed587bccd09c40de1b8a2221f2f669f5c3e70affb
parentae8060d4aded662197f25d4312f18d0534edb15a (diff)
stub out ForegroundLayer param
-rw-r--r--Emby.Drawing/ImageMagick/ImageMagickEncoder.cs13
-rw-r--r--Emby.Drawing/ImageProcessor.cs7
-rw-r--r--MediaBrowser.Api/Images/ImageRequest.cs5
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs1
-rw-r--r--MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs4
5 files changed, 27 insertions, 3 deletions
diff --git a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
index b8300ac97..7779c2fc5 100644
--- a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
+++ b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
@@ -155,6 +155,7 @@ namespace Emby.Drawing.ImageMagick
AutoOrientImage(originalImage);
}
+ AddForegroundLayer(originalImage, options);
DrawIndicator(originalImage, width, height, options);
originalImage.CurrentImage.CompressionQuality = quality;
@@ -177,6 +178,8 @@ namespace Emby.Drawing.ImageMagick
}
wand.CurrentImage.CompositeImage(originalImage, CompositeOperator.OverCompositeOp, 0, 0);
+
+ AddForegroundLayer(wand, options);
DrawIndicator(wand, width, height, options);
wand.CurrentImage.CompressionQuality = quality;
@@ -189,6 +192,16 @@ namespace Emby.Drawing.ImageMagick
SaveDelay();
}
+ private void AddForegroundLayer(MagickWand wand, ImageProcessingOptions options)
+ {
+ if (string.IsNullOrWhiteSpace(options.ForegroundLayer))
+ {
+ return;
+ }
+
+ // TODO
+ }
+
private void AutoOrientImage(MagickWand wand)
{
wand.CurrentImage.AutoOrientImage();
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index e01612700..ef608d266 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -473,7 +473,7 @@ namespace Emby.Drawing
/// <summary>
/// Gets the cache file path based on a set of parameters
/// </summary>
- private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor)
+ private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor, string foregroundLayer)
{
var filename = originalPath;
@@ -507,6 +507,11 @@ namespace Emby.Drawing
filename += "b=" + backgroundColor;
}
+ if (!string.IsNullOrEmpty(foregroundLayer))
+ {
+ filename += "fl=" + foregroundLayer;
+ }
+
filename += "v=" + Version;
return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower());
diff --git a/MediaBrowser.Api/Images/ImageRequest.cs b/MediaBrowser.Api/Images/ImageRequest.cs
index cdd348bb5..8b86ee7e0 100644
--- a/MediaBrowser.Api/Images/ImageRequest.cs
+++ b/MediaBrowser.Api/Images/ImageRequest.cs
@@ -66,7 +66,10 @@ namespace MediaBrowser.Api.Images
[ApiMember(Name = "BackgroundColor", Description = "Optional. Apply a background color for transparent images.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string BackgroundColor { get; set; }
-
+
+ [ApiMember(Name = "ForegroundLayer", Description = "Optional. Apply a foreground layer on top of the image.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string ForegroundLayer { get; set; }
+
public ImageRequest()
{
EnableImageEnhancers = true;
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 7122c8fc1..8d58070fd 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -624,6 +624,7 @@ namespace MediaBrowser.Api.Images
PercentPlayed = request.PercentPlayed ?? 0,
UnplayedCount = request.UnplayedCount,
BackgroundColor = request.BackgroundColor,
+ ForegroundLayer = request.ForegroundLayer,
SupportedOutputFormats = supportedFormats
};
diff --git a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs
index 2b80b701e..3fd8d84dd 100644
--- a/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs
+++ b/MediaBrowser.Controller/Drawing/ImageProcessingOptions.cs
@@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.Drawing
public double PercentPlayed { get; set; }
public string BackgroundColor { get; set; }
+ public string ForegroundLayer { get; set; }
public bool HasDefaultOptions(string originalImagePath)
{
@@ -83,7 +84,8 @@ namespace MediaBrowser.Controller.Drawing
!AddPlayedIndicator &&
PercentPlayed.Equals(0) &&
!UnplayedCount.HasValue &&
- string.IsNullOrEmpty(BackgroundColor);
+ string.IsNullOrEmpty(BackgroundColor) &&
+ string.IsNullOrEmpty(ForegroundLayer);
}
private bool IsFormatSupported(string originalImagePath)