diff --git a/binding/Binding/SKColorFilter.cs b/binding/Binding/SKColorFilter.cs index 96e4d2a1..41250fa6 100644 --- a/binding/Binding/SKColorFilter.cs +++ b/binding/Binding/SKColorFilter.cs @@ -7,6 +7,7 @@ namespace SkiaSharp public class SKColorFilter : SKObject { public const int ColorMatrixSize = 20; + public const int TableMaxLength = 256; [Preserve] internal SKColorFilter(IntPtr handle, bool owns) @@ -61,21 +62,21 @@ namespace SkiaSharp { if (table == null) throw new ArgumentNullException(nameof(table)); - if (table.Length != SKColorTable.MaxLength) - throw new ArgumentException($"Table must have a length of {SKColorTable.MaxLength}.", nameof(table)); + if (table.Length != TableMaxLength) + throw new ArgumentException($"Table must have a length of {TableMaxLength}.", nameof(table)); return GetObject(SkiaApi.sk_colorfilter_new_table(table)); } public static SKColorFilter CreateTable(byte[] tableA, byte[] tableR, byte[] tableG, byte[] tableB) { - if (tableA != null && tableA.Length != SKColorTable.MaxLength) - throw new ArgumentException($"Table A must have a length of {SKColorTable.MaxLength}.", nameof(tableA)); - if (tableR != null && tableR.Length != SKColorTable.MaxLength) - throw new ArgumentException($"Table R must have a length of {SKColorTable.MaxLength}.", nameof(tableR)); - if (tableG != null && tableG.Length != SKColorTable.MaxLength) - throw new ArgumentException($"Table G must have a length of {SKColorTable.MaxLength}.", nameof(tableG)); - if (tableB != null && tableB.Length != SKColorTable.MaxLength) - throw new ArgumentException($"Table B must have a length of {SKColorTable.MaxLength}.", nameof(tableB)); + if (tableA != null && tableA.Length != TableMaxLength) + throw new ArgumentException($"Table A must have a length of {TableMaxLength}.", nameof(tableA)); + if (tableR != null && tableR.Length != TableMaxLength) + throw new ArgumentException($"Table R must have a length of {TableMaxLength}.", nameof(tableR)); + if (tableG != null && tableG.Length != TableMaxLength) + throw new ArgumentException($"Table G must have a length of {TableMaxLength}.", nameof(tableG)); + if (tableB != null && tableB.Length != TableMaxLength) + throw new ArgumentException($"Table B must have a length of {TableMaxLength}.", nameof(tableB)); return GetObject(SkiaApi.sk_colorfilter_new_table_argb(tableA, tableR, tableG, tableB)); } diff --git a/binding/Binding/SKColorTable.cs b/binding/Binding/SKColorTable.cs index 6704bb64..61bdf80b 100644 --- a/binding/Binding/SKColorTable.cs +++ b/binding/Binding/SKColorTable.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; namespace SkiaSharp { + [Obsolete ("The Index8 color type and color table is no longer supported.")] public class SKColorTable : SKObject { public const int MaxLength = 256; diff --git a/binding/Binding/SKMaskFilter.cs b/binding/Binding/SKMaskFilter.cs index 6c8b669e..3b6cd4e1 100644 --- a/binding/Binding/SKMaskFilter.cs +++ b/binding/Binding/SKMaskFilter.cs @@ -19,7 +19,8 @@ namespace SkiaSharp public class SKMaskFilter : SKObject { private const float BlurSigmaScale = 0.57735f; - + public const int TableMaxLength = 256; + [Preserve] internal SKMaskFilter (IntPtr handle, bool owns) : base (handle, owns) @@ -76,7 +77,7 @@ namespace SkiaSharp { if (table == null) throw new ArgumentNullException(nameof(table)); - if (table.Length != SKColorTable.MaxLength) + if (table.Length != TableMaxLength) throw new ArgumentException("Table must have a length of {SKColorTable.MaxLength}.", nameof(table)); return GetObject(SkiaApi.sk_maskfilter_new_table(table)); } diff --git a/tests/Tests/SKColorTableTest.cs b/tests/Tests/SKColorTableTest.cs index 8ba2d151..c22306e8 100644 --- a/tests/Tests/SKColorTableTest.cs +++ b/tests/Tests/SKColorTableTest.cs @@ -28,6 +28,7 @@ namespace SkiaSharp.Tests (SKPMColor)SKColors.Blue }; + [Obsolete] [SkippableFact] public void MembersRetrieveSingleColorWithAlpha() { @@ -47,6 +48,7 @@ namespace SkiaSharp.Tests Assert.Equal(new SKPMColor(0x33001A00), ct[0]); } + [Obsolete] [SkippableFact] public void MembersRetrieveColors() { @@ -65,6 +67,7 @@ namespace SkiaSharp.Tests Assert.Equal(PMColors[5], colorTable[5]); } + [Obsolete] [SkippableFact] public void IndexerOutOfRangeBelow() { @@ -76,6 +79,7 @@ namespace SkiaSharp.Tests }); } + [Obsolete] [SkippableFact] public void IndexerOutOfRangeAbove() { diff --git a/tests/Tests/SKFontManagerTest.cs b/tests/Tests/SKFontManagerTest.cs index 4c19caba..24799aa9 100644 --- a/tests/Tests/SKFontManagerTest.cs +++ b/tests/Tests/SKFontManagerTest.cs @@ -62,6 +62,7 @@ namespace SkiaSharp.Tests Assert.Equal((int)SKFontStyleWeight.Bold, tf.FontWeight); } + [Obsolete] [SkippableFact] public void TestMatchTypeface() { @@ -81,6 +82,7 @@ namespace SkiaSharp.Tests Assert.Equal(normal.FamilyName, bold.FamilyName); } + [Obsolete] [SkippableFact] public void TestMatchTypefaceFromStream() {