diff options
Diffstat (limited to 'Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs')
| -rw-r--r-- | Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs b/Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs index dbf935f4e..a10fff9df 100644 --- a/Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs +++ b/Jellyfin.Drawing.Skia/UnplayedCountIndicator.cs @@ -4,10 +4,25 @@ using SkiaSharp; namespace Jellyfin.Drawing.Skia { + /// <summary> + /// Static helper class for drawing unplayed count indicators. + /// </summary> public static class UnplayedCountIndicator { + /// <summary> + /// The x-offset used when drawing an unplayed count indicator. + /// </summary> private const int OffsetFromTopRightCorner = 38; + /// <summary> + /// Draw an unplayed count indicator in the top right corner of a canvas. + /// </summary> + /// <param name="canvas">The canvas to draw the indicator on.</param> + /// <param name="imageSize"> + /// The dimensions of the image to draw the indicator on. The width is used to determine the x-position of the + /// indicator. + /// </param> + /// <param name="count">The number to draw in the indicator.</param> public static void DrawUnplayedCountIndicator(SKCanvas canvas, ImageDimensions imageSize, int count) { var x = imageSize.Width - OffsetFromTopRightCorner; @@ -19,6 +34,7 @@ namespace Jellyfin.Drawing.Skia paint.Style = SKPaintStyle.Fill; canvas.DrawCircle((float)x, OffsetFromTopRightCorner, 20, paint); } + using (var paint = new SKPaint()) { paint.Color = new SKColor(255, 255, 255, 255); @@ -33,6 +49,7 @@ namespace Jellyfin.Drawing.Skia { x -= 7; } + if (text.Length == 2) { x -= 13; |
