marking everything with color tables as obsolete

- this is now a private api
 - may be removed at any time
This commit is contained in:
Matthew Leibowitz 2018-07-21 22:51:30 +02:00
Родитель 04883d0fb6
Коммит 30c119ae9e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3650EBE4AA155AF9
5 изменённых файлов: 21 добавлений и 12 удалений

Просмотреть файл

@ -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<SKColorFilter>(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<SKColorFilter>(SkiaApi.sk_colorfilter_new_table_argb(tableA, tableR, tableG, tableB));
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -19,6 +19,7 @@ namespace SkiaSharp
public class SKMaskFilter : SKObject
{
private const float BlurSigmaScale = 0.57735f;
public const int TableMaxLength = 256;
[Preserve]
internal SKMaskFilter (IntPtr handle, bool 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<SKMaskFilter>(SkiaApi.sk_maskfilter_new_table(table));
}

Просмотреть файл

@ -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()
{

Просмотреть файл

@ -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()
{