diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-11 12:33:10 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-11 12:33:10 -0500 |
| commit | 5655787c1ac9ceedbd78c6c853a7cded33a22d49 (patch) | |
| tree | efb58d6a215a227f09aa0ce95c97891718d05d6e /Emby.Drawing.Net/PercentPlayedDrawer.cs | |
| parent | 13ec531b142bb95bc599dc8efcc9e204f14e3e03 (diff) | |
update portable projects
Diffstat (limited to 'Emby.Drawing.Net/PercentPlayedDrawer.cs')
| -rw-r--r-- | Emby.Drawing.Net/PercentPlayedDrawer.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Emby.Drawing.Net/PercentPlayedDrawer.cs b/Emby.Drawing.Net/PercentPlayedDrawer.cs new file mode 100644 index 000000000..fac15ba47 --- /dev/null +++ b/Emby.Drawing.Net/PercentPlayedDrawer.cs @@ -0,0 +1,34 @@ +using System; +using System.Drawing; + +namespace Emby.Drawing.Net +{ + public class PercentPlayedDrawer + { + private const int IndicatorHeight = 8; + + public void Process(Graphics graphics, Size imageSize, double percent) + { + var y = imageSize.Height - IndicatorHeight; + + using (var backdroundBrush = new SolidBrush(Color.FromArgb(225, 0, 0, 0))) + { + const int innerX = 0; + var innerY = y; + var innerWidth = imageSize.Width; + var innerHeight = imageSize.Height; + + graphics.FillRectangle(backdroundBrush, innerX, innerY, innerWidth, innerHeight); + + using (var foregroundBrush = new SolidBrush(Color.FromArgb(82, 181, 75))) + { + double foregroundWidth = innerWidth; + foregroundWidth *= percent; + foregroundWidth /= 100; + + graphics.FillRectangle(foregroundBrush, innerX, innerY, Convert.ToInt32(Math.Round(foregroundWidth)), innerHeight); + } + } + } + } +} |
