diff options
Diffstat (limited to 'src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs')
| -rw-r--r-- | src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs b/src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs index 6136a2ff98..e2e90be475 100644 --- a/src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs +++ b/src/Jellyfin.Drawing.Skia/PercentPlayedDrawer.cs @@ -2,35 +2,34 @@ using System; using MediaBrowser.Model.Drawing; using SkiaSharp; -namespace Jellyfin.Drawing.Skia +namespace Jellyfin.Drawing.Skia; + +/// <summary> +/// Static helper class used to draw percentage-played indicators on images. +/// </summary> +public static class PercentPlayedDrawer { + private const int IndicatorHeight = 8; + /// <summary> - /// Static helper class used to draw percentage-played indicators on images. + /// Draw a percentage played indicator on a canvas. /// </summary> - public static class PercentPlayedDrawer + /// <param name="canvas">The canvas to draw the indicator on.</param> + /// <param name="imageSize">The size of the image being drawn on.</param> + /// <param name="percent">The percentage played to display with the indicator.</param> + public static void Process(SKCanvas canvas, ImageDimensions imageSize, double percent) { - private const int IndicatorHeight = 8; - - /// <summary> - /// Draw a percentage played indicator on a canvas. - /// </summary> - /// <param name="canvas">The canvas to draw the indicator on.</param> - /// <param name="imageSize">The size of the image being drawn on.</param> - /// <param name="percent">The percentage played to display with the indicator.</param> - public static void Process(SKCanvas canvas, ImageDimensions imageSize, double percent) - { - using var paint = new SKPaint(); - var endX = imageSize.Width - 1; - var endY = imageSize.Height - 1; + 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, endX, endY), paint); + paint.Color = SKColor.Parse("#99000000"); + paint.Style = SKPaintStyle.Fill; + canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, endX, endY), paint); - double foregroundWidth = (endX * percent) / 100; + double foregroundWidth = (endX * percent) / 100; - paint.Color = SKColor.Parse("#FF00A4DC"); - canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, Convert.ToInt32(foregroundWidth), endY), paint); - } + paint.Color = SKColor.Parse("#FF00A4DC"); + canvas.DrawRect(SKRect.Create(0, (float)endY - IndicatorHeight, Convert.ToInt32(foregroundWidth), endY), paint); } } |
