2019-01-13 19:54:44 +00:00
|
|
|
using System;
|
2017-05-09 19:53:46 +00:00
|
|
|
using MediaBrowser.Model.Drawing;
|
2019-01-13 19:16:43 +00:00
|
|
|
using SkiaSharp;
|
2017-05-09 19:53:46 +00:00
|
|
|
|
2019-01-26 19:43:13 +00:00
|
|
|
namespace Jellyfin.Drawing.Skia
|
2017-05-09 19:53:46 +00:00
|
|
|
{
|
2019-01-20 13:25:13 +00:00
|
|
|
public static class PercentPlayedDrawer
|
2017-05-09 19:53:46 +00:00
|
|
|
{
|
|
|
|
private const int IndicatorHeight = 8;
|
|
|
|
|
2019-01-26 12:16:47 +00:00
|
|
|
public static void Process(SKCanvas canvas, ImageDimensions imageSize, double percent)
|
2017-05-09 19:53:46 +00:00
|
|
|
{
|
|
|
|
using (var paint = new SKPaint())
|
|
|
|
{
|
|
|
|
var endX = imageSize.Width - 1;
|
|
|
|
var endY = imageSize.Height - 1;
|
|
|
|
|
|
|
|
paint.Color = SKColor.Parse("#99000000");
|
|
|
|
paint.Style = SKPaintStyle.Fill;
|
|
|
|
canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, (float)endX, (float)endY), paint);
|
|
|
|
|
|
|
|
double foregroundWidth = endX;
|
|
|
|
foregroundWidth *= percent;
|
|
|
|
foregroundWidth /= 100;
|
|
|
|
|
2019-03-05 03:36:23 +00:00
|
|
|
paint.Color = SKColor.Parse("#FF00A4DC");
|
2019-01-26 12:16:47 +00:00
|
|
|
canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, Convert.ToInt32(foregroundWidth), (float)endY), paint);
|
2017-05-09 19:53:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|