aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-21 11:06:00 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-21 11:06:00 -0400
commitf380d7a092ef474754400647debbc3d90e8451a0 (patch)
treeeaffee3e8d38a21958f126d22fb26975f3e557fa /MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
parentb9bb87100bc1375b0c8b311820e9289323aaefa3 (diff)
added percent played overlay
Diffstat (limited to 'MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs b/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
new file mode 100644
index 000000000..355824458
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Drawing/PercentPlayedDrawer.cs
@@ -0,0 +1,36 @@
+using System.Drawing;
+using System.Globalization;
+
+namespace MediaBrowser.Server.Implementations.Drawing
+{
+ public class PercentPlayedDrawer
+ {
+ private const int IndicatorWidth = 80;
+ private const int IndicatorHeight = 50;
+ private const int FontSize = 30;
+ private readonly CultureInfo _usCulture = new CultureInfo("en-US");
+
+ public void Process(Graphics graphics, Size imageSize, int percent)
+ {
+ var x = imageSize.Width - IndicatorWidth;
+
+ using (var backdroundBrush = new SolidBrush(Color.FromArgb(225, 102, 192, 16)))
+ {
+ graphics.FillRectangle(backdroundBrush, x, 0, IndicatorWidth, IndicatorHeight);
+
+ var text = string.Format("{0}%", percent.ToString(_usCulture));
+
+ x = imageSize.Width - (percent < 10 ? 66 : 75);
+
+ using (var font = new Font(FontFamily.GenericSansSerif, FontSize, FontStyle.Regular, GraphicsUnit.Pixel))
+ {
+ using (var fontBrush = new SolidBrush(Color.White))
+ {
+ graphics.DrawString(text, font, fontBrush, x, 6);
+ }
+ }
+ }
+
+ }
+ }
+}