diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs b/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs index 68f66e977..20c2ab93b 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); } } } |
