You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
6 years ago
|
using System;
|
||
8 years ago
|
using MediaBrowser.Model.Drawing;
|
||
6 years ago
|
using SkiaSharp;
|
||
8 years ago
|
|
||
6 years ago
|
namespace Jellyfin.Drawing.Skia
|
||
8 years ago
|
{
|
||
6 years ago
|
public static class PercentPlayedDrawer
|
||
8 years ago
|
{
|
||
|
private const int IndicatorHeight = 8;
|
||
|
|
||
6 years ago
|
public static void Process(SKCanvas canvas, ImageDimensions imageSize, double percent)
|
||
8 years ago
|
{
|
||
|
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;
|
||
|
|
||
|
paint.Color = SKColor.Parse("#FF52B54B");
|
||
6 years ago
|
canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, Convert.ToInt32(foregroundWidth), (float)endY), paint);
|
||
8 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|