diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-15 23:40:36 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-15 23:40:36 -0400 |
| commit | d2b86edf0532af617c233c01ac0973c44448c447 (patch) | |
| tree | 30979b9a36a745a02587ed371480552f6a04120a /Emby.Drawing.Skia | |
| parent | ee5fdd41203e24f0e7b8a2bf3b55f54427d0167b (diff) | |
update hdhr channel ids
Diffstat (limited to 'Emby.Drawing.Skia')
| -rw-r--r-- | Emby.Drawing.Skia/SkiaEncoder.cs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index 071c40c29e..77ab1919aa 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -74,8 +74,9 @@ namespace Emby.Drawing.Skia return typeof(SKBitmap).GetTypeInfo().Assembly.GetName().Version.ToString(); } - private static bool IsWhiteSpace(SKColor color) + private static bool IsTransparent(SKColor color) { + return (color.Red == 255 && color.Green == 255 && color.Blue == 255) || color.Alpha == 0; } @@ -96,11 +97,11 @@ namespace Emby.Drawing.Skia } } - private static bool IsAllWhiteRow(SKBitmap bmp, int row) + private static bool IsTransparentRow(SKBitmap bmp, int row) { for (var i = 0; i < bmp.Width; ++i) { - if (!IsWhiteSpace(bmp.GetPixel(i, row))) + if (!IsTransparent(bmp.GetPixel(i, row))) { return false; } @@ -108,11 +109,11 @@ namespace Emby.Drawing.Skia return true; } - private static bool IsAllWhiteColumn(SKBitmap bmp, int col) + private static bool IsTransparentColumn(SKBitmap bmp, int col) { for (var i = 0; i < bmp.Height; ++i) { - if (!IsWhiteSpace(bmp.GetPixel(col, i))) + if (!IsTransparent(bmp.GetPixel(col, i))) { return false; } @@ -125,7 +126,7 @@ namespace Emby.Drawing.Skia var topmost = 0; for (int row = 0; row < bitmap.Height; ++row) { - if (IsAllWhiteRow(bitmap, row)) + if (IsTransparentRow(bitmap, row)) topmost = row + 1; else break; } @@ -133,7 +134,7 @@ namespace Emby.Drawing.Skia int bottommost = bitmap.Height; for (int row = bitmap.Height - 1; row >= 0; --row) { - if (IsAllWhiteRow(bitmap, row)) + if (IsTransparentRow(bitmap, row)) bottommost = row; else break; } @@ -141,7 +142,7 @@ namespace Emby.Drawing.Skia int leftmost = 0, rightmost = bitmap.Width; for (int col = 0; col < bitmap.Width; ++col) { - if (IsAllWhiteColumn(bitmap, col)) + if (IsTransparentColumn(bitmap, col)) leftmost = col + 1; else break; @@ -149,7 +150,7 @@ namespace Emby.Drawing.Skia for (int col = bitmap.Width - 1; col >= 0; --col) { - if (IsAllWhiteColumn(bitmap, col)) + if (IsTransparentColumn(bitmap, col)) rightmost = col; else break; |
