aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-02 11:32:11 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-10-02 11:32:11 -0400
commit7dae0069d65883d8b2a5ba635991354eb395b7c6 (patch)
tree21c7b523f888f6bbec528534a6d521473bab4dbd /MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
parentf87454336e0bd1f5cb21353a2da116eacfd1adb9 (diff)
added new image params & GameSystem constants
Diffstat (limited to 'MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs33
1 files changed, 20 insertions, 13 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
index 7a16747fb..d07352149 100644
--- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs
@@ -109,7 +109,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
var quality = options.Quality ?? 90;
- var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, options.OutputFormat, options.Indicator, options.PercentPlayed, options.BackgroundColor);
+ var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, options.OutputFormat, options.AddPlayedIndicator, options.PercentPlayed, options.BackgroundColor);
try
{
@@ -180,7 +180,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
thumbnailGraph.DrawImage(originalImage, 0, 0, newWidth, newHeight);
- DrawIndicator(thumbnailGraph, newWidth, newHeight, options.Indicator, options.PercentPlayed);
+ DrawIndicator(thumbnailGraph, newWidth, newHeight, options);
var outputFormat = GetOutputFormat(originalImage, options.OutputFormat);
@@ -277,28 +277,31 @@ namespace MediaBrowser.Server.Implementations.Drawing
/// <param name="graphics">The graphics.</param>
/// <param name="imageWidth">Width of the image.</param>
/// <param name="imageHeight">Height of the image.</param>
- /// <param name="indicator">The indicator.</param>
- /// <param name="percentPlayed">The percent played.</param>
- private void DrawIndicator(Graphics graphics, int imageWidth, int imageHeight, ImageOverlay? indicator, int percentPlayed)
+ /// <param name="options">The options.</param>
+ private void DrawIndicator(Graphics graphics, int imageWidth, int imageHeight, ImageProcessingOptions options)
{
- if (!indicator.HasValue)
+ if (!options.AddPlayedIndicator && !options.PercentPlayed.HasValue)
{
return;
}
try
{
- if (indicator.Value == ImageOverlay.Played)
+ var percentOffset = 0;
+
+ if (options.AddPlayedIndicator)
{
var currentImageSize = new Size(imageWidth, imageHeight);
new WatchedIndicatorDrawer().Process(graphics, currentImageSize);
+
+ percentOffset = 0 - WatchedIndicatorDrawer.IndicatorWidth;
}
- if (indicator.Value == ImageOverlay.PercentPlayed)
+ if (options.PercentPlayed.HasValue)
{
var currentImageSize = new Size(imageWidth, imageHeight);
- new PercentPlayedDrawer().Process(graphics, currentImageSize, percentPlayed);
+ new PercentPlayedDrawer().Process(graphics, currentImageSize, options.PercentPlayed.Value, percentOffset);
}
}
catch (Exception ex)
@@ -400,7 +403,7 @@ namespace MediaBrowser.Server.Implementations.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, ImageOutputFormat format, ImageOverlay? overlay, int percentPlayed, string backgroundColor)
+ private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageOutputFormat format, bool addPlayedIndicator, int? percentPlayed, string backgroundColor)
{
var filename = originalPath;
@@ -417,10 +420,14 @@ namespace MediaBrowser.Server.Implementations.Drawing
filename += "f=" + format;
}
- if (overlay.HasValue)
+ if (addPlayedIndicator)
+ {
+ filename += "pl=true";
+ }
+
+ if (percentPlayed.HasValue)
{
- filename += "o=" + overlay.Value;
- filename += "p=" + percentPlayed;
+ filename += "p=" + percentPlayed.Value;
}
if (!string.IsNullOrEmpty(backgroundColor))