aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-03-19 13:21:35 -0400
committerLuke <luke.pulverenti@gmail.com>2015-03-19 13:21:35 -0400
commit9926be0d9de688c04065c916e44ada4177b38a80 (patch)
tree15338144a143948ffbee316641757e81489a7354 /MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
parentb756e677d733992c2033bdd369980a37e17609e4 (diff)
parent0564d454e5ad4f59702aa9022af6bb8fd064a9ff (diff)
Merge pull request #1043 from MediaBrowser/dev
3.0.5557.0
Diffstat (limited to 'MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs34
1 files changed, 20 insertions, 14 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs b/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
index 68f66e9772..20c2ab93be 100644
--- a/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
+++ b/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
@@ -1,5 +1,5 @@
-using System;
-using System.Drawing;
+using ImageMagickSharp;
+using System;
namespace MediaBrowser.Server.Implementations.Drawing
{
@@ -7,26 +7,32 @@ namespace MediaBrowser.Server.Implementations.Drawing
{
private const int IndicatorHeight = 8;
- public void Process(Graphics graphics, Size imageSize, double percent)
+ public void Process(MagickWand wand, double percent)
{
- var y = imageSize.Height - IndicatorHeight;
+ var currentImage = wand.CurrentImage;
+ var height = currentImage.Height;
- using (var backdroundBrush = new SolidBrush(Color.FromArgb(225, 0, 0, 0)))
+ using (var draw = new DrawingWand())
{
- const int innerX = 0;
- var innerY = y;
- var innerWidth = imageSize.Width;
- var innerHeight = imageSize.Height;
+ using (PixelWand pixel = new PixelWand())
+ {
+ var endX = currentImage.Width - 1;
+ var endY = height - 1;
- graphics.FillRectangle(backdroundBrush, innerX, innerY, innerWidth, innerHeight);
+ pixel.Color = "black";
+ pixel.Opacity = 0.4;
+ draw.FillColor = pixel;
+ draw.DrawRectangle(0, endY - IndicatorHeight, endX, endY);
- using (var foregroundBrush = new SolidBrush(Color.FromArgb(82, 181, 75)))
- {
- double foregroundWidth = innerWidth;
+ double foregroundWidth = endX;
foregroundWidth *= percent;
foregroundWidth /= 100;
- graphics.FillRectangle(foregroundBrush, innerX, innerY, Convert.ToInt32(Math.Round(foregroundWidth)), innerHeight);
+ pixel.Color = "#52B54B";
+ pixel.Opacity = 0;
+ draw.FillColor = pixel;
+ draw.DrawRectangle(0, endY - IndicatorHeight, Convert.ToInt32(Math.Round(foregroundWidth)), endY);
+ wand.CurrentImage.DrawImage(draw);
}
}
}