aboutsummaryrefslogtreecommitdiff
path: root/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2023-01-10 19:41:55 -0500
committerPatrick Barron <barronpm@gmail.com>2023-01-10 19:41:55 -0500
commitcafc454cfbd316175ce1234741699ce43cb43341 (patch)
tree1eb2b1ada84dd727d67ffd87f50a0fab24c9f275 /src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
parent6c7225b94357ad9b75103cd4a689cf6e6c338bd1 (diff)
Use file-scoped namespaces in Jellyfin.Drawing.Skia
Diffstat (limited to 'src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs')
-rw-r--r--src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs b/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
index 2a37299428..5bb42fb99e 100644
--- a/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
+++ b/src/Jellyfin.Drawing.Skia/PlayedIndicatorDrawer.cs
@@ -1,48 +1,47 @@
using MediaBrowser.Model.Drawing;
using SkiaSharp;
-namespace Jellyfin.Drawing.Skia
+namespace Jellyfin.Drawing.Skia;
+
+/// <summary>
+/// Static helper class for drawing 'played' indicators.
+/// </summary>
+public static class PlayedIndicatorDrawer
{
+ private const int OffsetFromTopRightCorner = 38;
+
/// <summary>
- /// Static helper class for drawing 'played' indicators.
+ /// Draw a 'played' indicator in the top right corner of a canvas.
/// </summary>
- public static class PlayedIndicatorDrawer
+ /// <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>
+ public static void DrawPlayedIndicator(SKCanvas canvas, ImageDimensions imageSize)
{
- private const int OffsetFromTopRightCorner = 38;
-
- /// <summary>
- /// Draw a 'played' 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>
- public static void DrawPlayedIndicator(SKCanvas canvas, ImageDimensions imageSize)
- {
- var x = imageSize.Width - OffsetFromTopRightCorner;
+ var x = imageSize.Width - OffsetFromTopRightCorner;
- using var paint = new SKPaint
- {
- Color = SKColor.Parse("#CC00A4DC"),
- Style = SKPaintStyle.Fill
- };
+ using var paint = new SKPaint
+ {
+ Color = SKColor.Parse("#CC00A4DC"),
+ Style = SKPaintStyle.Fill
+ };
- canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
+ canvas.DrawCircle(x, OffsetFromTopRightCorner, 20, paint);
- paint.Color = new SKColor(255, 255, 255, 255);
- paint.TextSize = 30;
- paint.IsAntialias = true;
+ paint.Color = new SKColor(255, 255, 255, 255);
+ paint.TextSize = 30;
+ paint.IsAntialias = true;
- // or:
- // var emojiChar = 0x1F680;
- const string Text = "✔️";
- var emojiChar = StringUtilities.GetUnicodeCharacterCode(Text, SKTextEncoding.Utf32);
+ // or:
+ // var emojiChar = 0x1F680;
+ const string Text = "✔️";
+ var emojiChar = StringUtilities.GetUnicodeCharacterCode(Text, SKTextEncoding.Utf32);
- // ask the font manager for a font with that character
- paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
+ // ask the font manager for a font with that character
+ paint.Typeface = SKFontManager.Default.MatchCharacter(emojiChar);
- canvas.DrawText(Text, (float)x - 12, OffsetFromTopRightCorner + 12, paint);
- }
+ canvas.DrawText(Text, (float)x - 12, OffsetFromTopRightCorner + 12, paint);
}
}