зеркало из https://github.com/mono/SkiaSharp.git
Remove all [Obsolete] members and types (#2539)
* Remove all [Obsolete] APIs from the bindings * Remove all [Obsolete] APIs from the source * Fix up the tests after removing things * Fix up the samples
This commit is contained in:
Родитель
8d33bf9cc4
Коммит
a140a2033c
|
@ -15,13 +15,6 @@ namespace HarfBuzzSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Blob(IntPtr, int, MemoryMode, ReleaseDelegate) instead.")]
|
||||
public Blob (IntPtr data, uint length, MemoryMode mode, object userData, BlobReleaseDelegate releaseDelegate)
|
||||
: this (data, (int)length, mode, () => releaseDelegate?.Invoke (userData))
|
||||
{
|
||||
}
|
||||
|
||||
public Blob (IntPtr data, int length, MemoryMode mode)
|
||||
: this (data, length, mode, null)
|
||||
{
|
||||
|
@ -57,11 +50,11 @@ namespace HarfBuzzSharp
|
|||
return new UnmanagedMemoryStream ((byte*)dataPtr, length);
|
||||
}
|
||||
|
||||
public unsafe ReadOnlySpan<byte> AsSpan ()
|
||||
public unsafe Span<byte> AsSpan ()
|
||||
{
|
||||
uint length;
|
||||
var dataPtr = HarfBuzzApi.hb_blob_get_data (Handle, &length);
|
||||
return new ReadOnlySpan<byte> (dataPtr, (int)length);
|
||||
return new Span<byte> (dataPtr, (int)length);
|
||||
}
|
||||
|
||||
public static Blob FromFile (string fileName)
|
||||
|
|
|
@ -7,10 +7,6 @@ namespace HarfBuzzSharp
|
|||
|
||||
public delegate Blob GetTableDelegate (Face face, Tag tag);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ReleaseDelegate instead.")]
|
||||
public delegate void BlobReleaseDelegate (object context);
|
||||
|
||||
internal static unsafe partial class DelegateProxies
|
||||
{
|
||||
// references to the proxy implementations
|
||||
|
|
|
@ -3,29 +3,6 @@ using System.ComponentModel;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKEncodedOrigin instead.")]
|
||||
public enum SKCodecOrigin
|
||||
{
|
||||
TopLeft = 1,
|
||||
TopRight = 2,
|
||||
BottomRight = 3,
|
||||
BottomLeft = 4,
|
||||
LeftTop = 5,
|
||||
RightTop = 6,
|
||||
RightBottom = 7,
|
||||
LeftBottom = 8,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKTextEncoding instead.")]
|
||||
public enum SKEncoding
|
||||
{
|
||||
Utf8 = 0,
|
||||
Utf16 = 1,
|
||||
Utf32 = 2,
|
||||
}
|
||||
|
||||
public enum SKFontStyleWeight
|
||||
{
|
||||
Invisible = 0,
|
||||
|
@ -93,28 +70,6 @@ namespace SkiaSharp
|
|||
public static bool IsHorizontal (this SKPixelGeometry pg) =>
|
||||
pg == SKPixelGeometry.BgrHorizontal || pg == SKPixelGeometry.RgbHorizontal;
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKTextEncoding ToTextEncoding (this SKEncoding encoding) =>
|
||||
encoding switch
|
||||
{
|
||||
SKEncoding.Utf8 => SKTextEncoding.Utf8,
|
||||
SKEncoding.Utf16 => SKTextEncoding.Utf16,
|
||||
SKEncoding.Utf32 => SKTextEncoding.Utf32,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (encoding)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal static SKEncoding ToEncoding (this SKTextEncoding encoding) =>
|
||||
encoding switch
|
||||
{
|
||||
SKTextEncoding.Utf8 => SKEncoding.Utf8,
|
||||
SKTextEncoding.Utf16 => SKEncoding.Utf16,
|
||||
SKTextEncoding.Utf32 => SKEncoding.Utf32,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (encoding)),
|
||||
};
|
||||
|
||||
// SkImageInfo.cpp - SkColorTypeBytesPerPixel
|
||||
public static int GetBytesPerPixel (this SKColorType colorType) =>
|
||||
colorType switch
|
||||
|
@ -199,35 +154,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKSurfaceProperties instead.")]
|
||||
public struct SKSurfaceProps : IEquatable<SKSurfaceProps>
|
||||
{
|
||||
public SKPixelGeometry PixelGeometry { readonly get; set; }
|
||||
public SKSurfacePropsFlags Flags { readonly get; set; }
|
||||
|
||||
public readonly bool Equals (SKSurfaceProps obj) =>
|
||||
PixelGeometry == obj.PixelGeometry &&
|
||||
Flags == obj.Flags;
|
||||
|
||||
public readonly override bool Equals (object obj) =>
|
||||
obj is SKSurfaceProps f && Equals (f);
|
||||
|
||||
public static bool operator == (SKSurfaceProps left, SKSurfaceProps right) =>
|
||||
left.Equals (right);
|
||||
|
||||
public static bool operator != (SKSurfaceProps left, SKSurfaceProps right) =>
|
||||
!left.Equals (right);
|
||||
|
||||
public readonly override int GetHashCode ()
|
||||
{
|
||||
var hash = new HashCode ();
|
||||
hash.Add (PixelGeometry);
|
||||
hash.Add (Flags);
|
||||
return hash.ToHashCode ();
|
||||
}
|
||||
}
|
||||
|
||||
public struct SKCodecOptions : IEquatable<SKCodecOptions>
|
||||
{
|
||||
public static readonly SKCodecOptions Default;
|
||||
|
@ -279,13 +205,6 @@ namespace SkiaSharp
|
|||
public int FrameIndex { readonly get; set; }
|
||||
public int PriorFrame { readonly get; set; }
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKTransferFunctionBehavior PremulBehavior {
|
||||
readonly get => SKTransferFunctionBehavior.Respect;
|
||||
set { }
|
||||
}
|
||||
|
||||
public readonly bool Equals (SKCodecOptions obj) =>
|
||||
ZeroInitialized == obj.ZeroInitialized &&
|
||||
Subset == obj.Subset &&
|
||||
|
@ -517,23 +436,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
[Flags]
|
||||
public enum SKColorSpaceFlags
|
||||
{
|
||||
None = 0,
|
||||
NonLinearBlending = 0x1,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public enum SKTransferFunctionBehavior
|
||||
{
|
||||
Ignore = 1,
|
||||
Respect = 0,
|
||||
}
|
||||
|
||||
public partial struct SKHighContrastConfig
|
||||
{
|
||||
public static readonly SKHighContrastConfig Default;
|
||||
|
@ -573,15 +475,6 @@ namespace SkiaSharp
|
|||
fComments = null;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Using SKPngEncoderOptions(SKPngEncoderFilterFlags, int) instead.")]
|
||||
public SKPngEncoderOptions (SKPngEncoderFilterFlags filterFlags, int zLibLevel, SKTransferFunctionBehavior unpremulBehavior)
|
||||
{
|
||||
fFilterFlags = filterFlags;
|
||||
fZLibLevel = zLibLevel;
|
||||
fComments = null;
|
||||
}
|
||||
|
||||
public SKPngEncoderFilterFlags FilterFlags {
|
||||
readonly get => fFilterFlags;
|
||||
set => fFilterFlags = value;
|
||||
|
@ -590,13 +483,6 @@ namespace SkiaSharp
|
|||
readonly get => fZLibLevel;
|
||||
set => fZLibLevel = value;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKTransferFunctionBehavior UnpremulBehavior {
|
||||
readonly get => SKTransferFunctionBehavior.Respect;
|
||||
set { }
|
||||
}
|
||||
}
|
||||
|
||||
public partial struct SKJpegEncoderOptions
|
||||
|
@ -614,22 +500,6 @@ namespace SkiaSharp
|
|||
fDownsample = downsample;
|
||||
fAlphaOption = alphaOption;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKJpegEncoderOptions(int, SKJpegEncoderDownsample, SKJpegEncoderAlphaOption) instead.")]
|
||||
public SKJpegEncoderOptions (int quality, SKJpegEncoderDownsample downsample, SKJpegEncoderAlphaOption alphaOption, SKTransferFunctionBehavior blendBehavior)
|
||||
{
|
||||
fQuality = quality;
|
||||
fDownsample = downsample;
|
||||
fAlphaOption = alphaOption;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKTransferFunctionBehavior BlendBehavior {
|
||||
readonly get => SKTransferFunctionBehavior.Respect;
|
||||
set { }
|
||||
}
|
||||
}
|
||||
|
||||
public partial struct SKWebpEncoderOptions
|
||||
|
@ -646,20 +516,5 @@ namespace SkiaSharp
|
|||
fCompression = compression;
|
||||
fQuality = quality;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKWebpEncoderOptions(SKWebpEncoderCompression, float) instead.")]
|
||||
public SKWebpEncoderOptions (SKWebpEncoderCompression compression, float quality, SKTransferFunctionBehavior unpremulBehavior)
|
||||
{
|
||||
fCompression = compression;
|
||||
fQuality = quality;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKTransferFunctionBehavior UnpremulBehavior {
|
||||
readonly get => SKTransferFunctionBehavior.Respect;
|
||||
set { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,6 @@ namespace SkiaSharp
|
|||
|
||||
public delegate void SKSurfaceReleaseDelegate (IntPtr address, object context);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRGlGetProcedureAddressDelegate instead.")]
|
||||
public delegate IntPtr GRGlGetProcDelegate (object context, string name);
|
||||
|
||||
public delegate IntPtr GRGlGetProcedureAddressDelegate (string name);
|
||||
|
||||
public delegate IntPtr GRVkGetProcedureAddressDelegate (string name, IntPtr instance, IntPtr device);
|
||||
|
|
|
@ -12,47 +12,6 @@ namespace SkiaSharp
|
|||
Direct3D = 4,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorType instead.")]
|
||||
public enum GRPixelConfig
|
||||
{
|
||||
Unknown = 0,
|
||||
Alpha8 = 1,
|
||||
Gray8 = 2,
|
||||
Rgb565 = 3,
|
||||
Rgba4444 = 4,
|
||||
Rgba8888 = 5,
|
||||
Rgb888 = 6,
|
||||
Bgra8888 = 7,
|
||||
Srgba8888 = 8,
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The pixel configuration 'sBGRA 8888' is no longer supported in the native library.", true)]
|
||||
Sbgra8888 = 9,
|
||||
Rgba1010102 = 10,
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The pixel configuration 'floating-point RGBA' is no longer supported in the native library.", true)]
|
||||
RgbaFloat = 11,
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The pixel configuration 'floating-point RG' is no longer supported in the native library.", true)]
|
||||
RgFloat = 12,
|
||||
AlphaHalf = 13,
|
||||
RgbaHalf = 14,
|
||||
Alpha8AsAlpha = 15,
|
||||
Alpha8AsRed = 16,
|
||||
AlphaHalfAsLum = 17,
|
||||
AlphaHalfAsRed = 18,
|
||||
Gray8AsLum = 19,
|
||||
Gray8AsRed = 20,
|
||||
RgbaHalfClamped = 21,
|
||||
Alpha16 = 22,
|
||||
Rg1616 = 23,
|
||||
Rgba16161616 = 24,
|
||||
RgHalf = 25,
|
||||
Rg88 = 26,
|
||||
Rgb888x = 27,
|
||||
RgbEtc1 = 28,
|
||||
}
|
||||
|
||||
public static partial class SkiaExtensions
|
||||
{
|
||||
internal static GRBackendNative ToNative (this GRBackend backend) =>
|
||||
|
|
|
@ -10,27 +10,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendRenderTarget(int, int, int, int, GRGlFramebufferInfo) instead.")]
|
||||
public GRBackendRenderTarget (GRBackend backend, GRBackendRenderTargetDesc desc)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
switch (backend) {
|
||||
case GRBackend.Metal:
|
||||
throw new NotSupportedException ();
|
||||
case GRBackend.OpenGL:
|
||||
var glInfo = new GRGlFramebufferInfo ((uint)desc.RenderTargetHandle, desc.Config.ToGlSizedFormat ());
|
||||
CreateGl (desc.Width, desc.Height, desc.SampleCount, desc.StencilBits, glInfo);
|
||||
break;
|
||||
case GRBackend.Vulkan:
|
||||
throw new NotSupportedException ();
|
||||
case GRBackend.Dawn:
|
||||
throw new NotSupportedException ();
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException (nameof (backend));
|
||||
}
|
||||
}
|
||||
|
||||
public GRBackendRenderTarget (int width, int height, int sampleCount, int stencilBits, GRGlFramebufferInfo glInfo)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
|
|
|
@ -11,30 +11,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendTexture(int, int, bool, GRGlTextureInfo) instead.")]
|
||||
public GRBackendTexture (GRGlBackendTextureDesc desc)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
var handle = desc.TextureHandle;
|
||||
if (handle.Format == 0) {
|
||||
handle.Format = desc.Config.ToGlSizedFormat ();
|
||||
}
|
||||
CreateGl (desc.Width, desc.Height, false, handle);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendTexture(int, int, bool, GRGlTextureInfo) instead.")]
|
||||
public GRBackendTexture (GRBackendTextureDesc desc)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
var handlePtr = desc.TextureHandle;
|
||||
var oldHandle = Marshal.PtrToStructure<GRTextureInfoObsolete> (handlePtr);
|
||||
|
||||
var handle = new GRGlTextureInfo (oldHandle.fTarget, oldHandle.fID, desc.Config.ToGlSizedFormat ());
|
||||
CreateGl (desc.Width, desc.Height, false, handle);
|
||||
}
|
||||
|
||||
public GRBackendTexture (int width, int height, bool mipmapped, GRGlTextureInfo glInfo)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
|
@ -103,13 +79,5 @@ namespace SkiaSharp
|
|||
return SkiaApi.gr_backendtexture_get_gl_textureinfo (Handle, g);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
internal struct GRTextureInfoObsolete
|
||||
{
|
||||
public uint fTarget;
|
||||
public uint fID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,44 +20,6 @@ namespace SkiaSharp
|
|||
base.DisposeNative ();
|
||||
}
|
||||
|
||||
// Create
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateGl() instead.")]
|
||||
public static GRContext Create (GRBackend backend) =>
|
||||
backend switch
|
||||
{
|
||||
GRBackend.Metal => throw new NotSupportedException (),
|
||||
GRBackend.OpenGL => CreateGl (),
|
||||
GRBackend.Vulkan => throw new NotSupportedException (),
|
||||
GRBackend.Dawn => throw new NotSupportedException (),
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (backend)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateGl(GRGlInterface) instead.")]
|
||||
public static GRContext Create (GRBackend backend, GRGlInterface backendContext) =>
|
||||
backend switch
|
||||
{
|
||||
GRBackend.Metal => throw new NotSupportedException (),
|
||||
GRBackend.OpenGL => CreateGl (backendContext),
|
||||
GRBackend.Vulkan => throw new NotSupportedException (),
|
||||
GRBackend.Dawn => throw new NotSupportedException (),
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (backend)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateGl(GRGlInterface) instead.")]
|
||||
public static GRContext Create (GRBackend backend, IntPtr backendContext) =>
|
||||
backend switch
|
||||
{
|
||||
GRBackend.Metal => throw new NotSupportedException (),
|
||||
GRBackend.OpenGL => GetObject (SkiaApi.gr_direct_context_make_gl (backendContext)),
|
||||
GRBackend.Vulkan => throw new NotSupportedException (),
|
||||
GRBackend.Dawn => throw new NotSupportedException (),
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (backend)),
|
||||
};
|
||||
|
||||
// CreateGl
|
||||
|
||||
public static GRContext CreateGl () =>
|
||||
|
@ -138,19 +100,6 @@ namespace SkiaSharp
|
|||
SkiaApi.gr_direct_context_abandon_context (Handle);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetResourceCacheLimit() instead.")]
|
||||
public void GetResourceCacheLimits (out int maxResources, out long maxResourceBytes)
|
||||
{
|
||||
maxResources = -1;
|
||||
maxResourceBytes = GetResourceCacheLimit ();
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SetResourceCacheLimit(long) instead.")]
|
||||
public void SetResourceCacheLimits (int maxResources, long maxResourceBytes) =>
|
||||
SetResourceCacheLimit (maxResourceBytes);
|
||||
|
||||
public long GetResourceCacheLimit () =>
|
||||
(long)SkiaApi.gr_direct_context_get_resource_cache_limit (Handle);
|
||||
|
||||
|
@ -191,10 +140,6 @@ namespace SkiaSharp
|
|||
public new int GetMaxSurfaceSampleCount (SKColorType colorType) =>
|
||||
base.GetMaxSurfaceSampleCount (colorType);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public int GetRecommendedSampleCount (GRPixelConfig config, float dpi) => 0;
|
||||
|
||||
public void DumpMemoryStatistics (SKTraceMemoryDump dump) =>
|
||||
SkiaApi.gr_direct_context_dump_memory_statistics (Handle, dump?.Handle ?? throw new ArgumentNullException (nameof (dump)));
|
||||
|
||||
|
|
|
@ -6,52 +6,6 @@ using GRBackendObject = System.IntPtr;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendRenderTarget instead.")]
|
||||
public struct GRBackendRenderTargetDesc : IEquatable<GRBackendRenderTargetDesc>
|
||||
{
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public GRPixelConfig Config { get; set; }
|
||||
public GRSurfaceOrigin Origin { get; set; }
|
||||
public int SampleCount { get; set; }
|
||||
public int StencilBits { get; set; }
|
||||
public GRBackendObject RenderTargetHandle { get; set; }
|
||||
public readonly SKSizeI Size => new SKSizeI (Width, Height);
|
||||
public readonly SKRectI Rect => new SKRectI (0, 0, Width, Height);
|
||||
|
||||
public readonly bool Equals (GRBackendRenderTargetDesc obj) =>
|
||||
Width == obj.Width &&
|
||||
Height == obj.Height &&
|
||||
Config == obj.Config &&
|
||||
Origin == obj.Origin &&
|
||||
SampleCount == obj.SampleCount &&
|
||||
StencilBits == obj.StencilBits &&
|
||||
RenderTargetHandle == obj.RenderTargetHandle;
|
||||
|
||||
public readonly override bool Equals (object obj) =>
|
||||
obj is GRBackendRenderTargetDesc f && Equals (f);
|
||||
|
||||
public static bool operator == (GRBackendRenderTargetDesc left, GRBackendRenderTargetDesc right) =>
|
||||
left.Equals (right);
|
||||
|
||||
public static bool operator != (GRBackendRenderTargetDesc left, GRBackendRenderTargetDesc right) =>
|
||||
!left.Equals (right);
|
||||
|
||||
public readonly override int GetHashCode ()
|
||||
{
|
||||
var hash = new HashCode ();
|
||||
hash.Add (Width);
|
||||
hash.Add (Height);
|
||||
hash.Add (Config);
|
||||
hash.Add (Origin);
|
||||
hash.Add (SampleCount);
|
||||
hash.Add (StencilBits);
|
||||
hash.Add (RenderTargetHandle);
|
||||
return hash.ToHashCode ();
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum GRGlBackendState : UInt32
|
||||
{
|
||||
|
@ -148,113 +102,10 @@ namespace SkiaSharp
|
|||
|
||||
#endif
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Flags]
|
||||
[Obsolete]
|
||||
public enum GRBackendTextureDescFlags
|
||||
{
|
||||
None = 0,
|
||||
RenderTarget = 1,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendTexture instead.")]
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
public struct GRBackendTextureDesc : IEquatable<GRBackendTextureDesc>
|
||||
{
|
||||
public GRBackendTextureDescFlags Flags { get; set; }
|
||||
public GRSurfaceOrigin Origin { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public GRPixelConfig Config { get; set; }
|
||||
public int SampleCount { get; set; }
|
||||
public GRBackendObject TextureHandle { get; set; }
|
||||
public readonly SKSizeI Size => new SKSizeI (Width, Height);
|
||||
public readonly SKRectI Rect => new SKRectI (0, 0, Width, Height);
|
||||
|
||||
public readonly bool Equals (GRBackendTextureDesc obj) =>
|
||||
Flags == obj.Flags &&
|
||||
Origin == obj.Origin &&
|
||||
Width == obj.Width &&
|
||||
Height == obj.Height &&
|
||||
Config == obj.Config &&
|
||||
SampleCount == obj.SampleCount &&
|
||||
TextureHandle == obj.TextureHandle;
|
||||
|
||||
public readonly override bool Equals (object obj) =>
|
||||
obj is GRBackendTextureDesc f && Equals (f);
|
||||
|
||||
public static bool operator == (GRBackendTextureDesc left, GRBackendTextureDesc right) =>
|
||||
left.Equals (right);
|
||||
|
||||
public static bool operator != (GRBackendTextureDesc left, GRBackendTextureDesc right) =>
|
||||
!left.Equals (right);
|
||||
|
||||
public readonly override int GetHashCode ()
|
||||
{
|
||||
var hash = new HashCode ();
|
||||
hash.Add (Flags);
|
||||
hash.Add (Origin);
|
||||
hash.Add (Width);
|
||||
hash.Add (Height);
|
||||
hash.Add (Config);
|
||||
hash.Add (SampleCount);
|
||||
hash.Add (TextureHandle);
|
||||
return hash.ToHashCode ();
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GRBackendTexture instead.")]
|
||||
public struct GRGlBackendTextureDesc : IEquatable<GRGlBackendTextureDesc>
|
||||
{
|
||||
public GRBackendTextureDescFlags Flags { get; set; }
|
||||
public GRSurfaceOrigin Origin { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public GRPixelConfig Config { get; set; }
|
||||
public int SampleCount { get; set; }
|
||||
public GRGlTextureInfo TextureHandle { get; set; }
|
||||
public readonly SKSizeI Size => new SKSizeI (Width, Height);
|
||||
public readonly SKRectI Rect => new SKRectI (0, 0, Width, Height);
|
||||
|
||||
public readonly bool Equals (GRGlBackendTextureDesc obj) =>
|
||||
Flags == obj.Flags &&
|
||||
Origin == obj.Origin &&
|
||||
Width == obj.Width &&
|
||||
Height == obj.Height &&
|
||||
Config == obj.Config &&
|
||||
SampleCount == obj.SampleCount &&
|
||||
TextureHandle == obj.TextureHandle;
|
||||
|
||||
public readonly override bool Equals (object obj) =>
|
||||
obj is GRGlBackendTextureDesc f && Equals (f);
|
||||
|
||||
public static bool operator == (GRGlBackendTextureDesc left, GRGlBackendTextureDesc right) =>
|
||||
left.Equals (right);
|
||||
|
||||
public static bool operator != (GRGlBackendTextureDesc left, GRGlBackendTextureDesc right) =>
|
||||
!left.Equals (right);
|
||||
|
||||
public readonly override int GetHashCode ()
|
||||
{
|
||||
var hash = new HashCode ();
|
||||
hash.Add (Flags);
|
||||
hash.Add (Origin);
|
||||
hash.Add (Width);
|
||||
hash.Add (Height);
|
||||
hash.Add (Config);
|
||||
hash.Add (SampleCount);
|
||||
hash.Add (TextureHandle);
|
||||
return hash.ToHashCode ();
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class SkiaExtensions
|
||||
{
|
||||
public static uint ToGlSizedFormat (this SKColorType colorType) =>
|
||||
colorType switch
|
||||
{
|
||||
colorType switch {
|
||||
SKColorType.Unknown => 0,
|
||||
SKColorType.Alpha8 => GRGlSizedFormat.ALPHA8,
|
||||
SKColorType.Gray8 => GRGlSizedFormat.LUMINANCE8,
|
||||
|
@ -274,104 +125,10 @@ namespace SkiaSharp
|
|||
SKColorType.Rg88 => GRGlSizedFormat.RG8,
|
||||
SKColorType.Rgb101010x => 0,
|
||||
SKColorType.RgbaF32 => 0,
|
||||
SKColorType.Bgra1010102 => 0,
|
||||
SKColorType.Bgr101010x => 0,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorType instead.")]
|
||||
public static uint ToGlSizedFormat (this GRPixelConfig config) =>
|
||||
config switch
|
||||
{
|
||||
GRPixelConfig.Unknown => 0,
|
||||
GRPixelConfig.Alpha8 => GRGlSizedFormat.ALPHA8,
|
||||
GRPixelConfig.Alpha8AsAlpha => GRGlSizedFormat.ALPHA8,
|
||||
GRPixelConfig.Alpha8AsRed => GRGlSizedFormat.ALPHA8,
|
||||
GRPixelConfig.Gray8 => GRGlSizedFormat.LUMINANCE8,
|
||||
GRPixelConfig.Gray8AsLum => GRGlSizedFormat.LUMINANCE8,
|
||||
GRPixelConfig.Gray8AsRed => GRGlSizedFormat.LUMINANCE8,
|
||||
GRPixelConfig.Rgb565 => GRGlSizedFormat.RGB565,
|
||||
GRPixelConfig.Rgba4444 => GRGlSizedFormat.RGBA4,
|
||||
GRPixelConfig.Rgba8888 => GRGlSizedFormat.RGBA8,
|
||||
GRPixelConfig.Rgb888 => GRGlSizedFormat.RGB8,
|
||||
GRPixelConfig.Rgb888x => GRGlSizedFormat.RGBA8,
|
||||
GRPixelConfig.Rg88 => GRGlSizedFormat.RG8,
|
||||
GRPixelConfig.Bgra8888 => GRGlSizedFormat.BGRA8,
|
||||
GRPixelConfig.Srgba8888 => GRGlSizedFormat.SRGB8_ALPHA8,
|
||||
GRPixelConfig.Rgba1010102 => GRGlSizedFormat.RGB10_A2,
|
||||
GRPixelConfig.AlphaHalf => GRGlSizedFormat.R16F,
|
||||
GRPixelConfig.AlphaHalfAsLum => GRGlSizedFormat.LUMINANCE16F,
|
||||
GRPixelConfig.AlphaHalfAsRed => GRGlSizedFormat.R16F,
|
||||
GRPixelConfig.RgbaHalf => GRGlSizedFormat.RGBA16F,
|
||||
GRPixelConfig.RgbaHalfClamped => GRGlSizedFormat.RGBA16F,
|
||||
GRPixelConfig.RgbEtc1 => GRGlSizedFormat.COMPRESSED_ETC1_RGB8,
|
||||
GRPixelConfig.Alpha16 => GRGlSizedFormat.R16,
|
||||
GRPixelConfig.Rg1616 => GRGlSizedFormat.RG16,
|
||||
GRPixelConfig.Rgba16161616 => GRGlSizedFormat.RGBA16,
|
||||
GRPixelConfig.RgHalf => GRGlSizedFormat.RG16F,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (config)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorType instead.")]
|
||||
public static GRPixelConfig ToPixelConfig (this SKColorType colorType) =>
|
||||
colorType switch
|
||||
{
|
||||
SKColorType.Unknown => GRPixelConfig.Unknown,
|
||||
SKColorType.Alpha8 => GRPixelConfig.Alpha8,
|
||||
SKColorType.Gray8 => GRPixelConfig.Gray8,
|
||||
SKColorType.Rgb565 => GRPixelConfig.Rgb565,
|
||||
SKColorType.Argb4444 => GRPixelConfig.Rgba4444,
|
||||
SKColorType.Rgba8888 => GRPixelConfig.Rgba8888,
|
||||
SKColorType.Rgb888x => GRPixelConfig.Rgb888,
|
||||
SKColorType.Bgra8888 => GRPixelConfig.Bgra8888,
|
||||
SKColorType.Rgba1010102 => GRPixelConfig.Rgba1010102,
|
||||
SKColorType.Bgra1010102 => GRPixelConfig.Unknown,
|
||||
SKColorType.AlphaF16 => GRPixelConfig.AlphaHalf,
|
||||
SKColorType.RgbaF16 => GRPixelConfig.RgbaHalf,
|
||||
SKColorType.RgbaF16Clamped => GRPixelConfig.RgbaHalfClamped,
|
||||
SKColorType.Alpha16 => GRPixelConfig.Alpha16,
|
||||
SKColorType.Rg1616 => GRPixelConfig.Rg1616,
|
||||
SKColorType.Rgba16161616 => GRPixelConfig.Rgba16161616,
|
||||
SKColorType.RgF16 => GRPixelConfig.RgHalf,
|
||||
SKColorType.Rg88 => GRPixelConfig.Rg88,
|
||||
SKColorType.Rgb101010x => GRPixelConfig.Unknown,
|
||||
SKColorType.Bgr101010x => GRPixelConfig.Unknown,
|
||||
SKColorType.RgbaF32 => GRPixelConfig.Unknown,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (colorType)),
|
||||
};
|
||||
|
||||
[Obsolete ("Use SKColorType instead.")]
|
||||
public static SKColorType ToColorType (this GRPixelConfig config) =>
|
||||
config switch
|
||||
{
|
||||
GRPixelConfig.Unknown => SKColorType.Unknown,
|
||||
GRPixelConfig.Alpha8 => SKColorType.Alpha8,
|
||||
GRPixelConfig.Gray8 => SKColorType.Gray8,
|
||||
GRPixelConfig.Rgb565 => SKColorType.Rgb565,
|
||||
GRPixelConfig.Rgba4444 => SKColorType.Argb4444,
|
||||
GRPixelConfig.Rgba8888 => SKColorType.Rgba8888,
|
||||
GRPixelConfig.Rgb888 => SKColorType.Rgb888x,
|
||||
GRPixelConfig.Bgra8888 => SKColorType.Bgra8888,
|
||||
GRPixelConfig.Srgba8888 => SKColorType.Rgba8888,
|
||||
GRPixelConfig.Rgba1010102 => SKColorType.Rgba1010102,
|
||||
GRPixelConfig.AlphaHalf => SKColorType.AlphaF16,
|
||||
GRPixelConfig.RgbaHalf => SKColorType.RgbaF16,
|
||||
GRPixelConfig.Alpha8AsAlpha => SKColorType.Alpha8,
|
||||
GRPixelConfig.Alpha8AsRed => SKColorType.Alpha8,
|
||||
GRPixelConfig.AlphaHalfAsLum => SKColorType.AlphaF16,
|
||||
GRPixelConfig.AlphaHalfAsRed => SKColorType.AlphaF16,
|
||||
GRPixelConfig.Gray8AsLum => SKColorType.Gray8,
|
||||
GRPixelConfig.Gray8AsRed => SKColorType.Gray8,
|
||||
GRPixelConfig.RgbaHalfClamped => SKColorType.RgbaF16Clamped,
|
||||
GRPixelConfig.Alpha16 => SKColorType.Alpha16,
|
||||
GRPixelConfig.Rg1616 => SKColorType.Rg1616,
|
||||
GRPixelConfig.Rgba16161616 => SKColorType.Rgba16161616,
|
||||
GRPixelConfig.RgHalf => SKColorType.RgF16,
|
||||
GRPixelConfig.Rg88 => SKColorType.Rg88,
|
||||
GRPixelConfig.Rgb888x => SKColorType.Rgb888x,
|
||||
GRPixelConfig.RgbEtc1 => SKColorType.Rgb888x,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (config)),
|
||||
};
|
||||
}
|
||||
|
||||
internal static class GRGlSizedFormat
|
||||
|
|
|
@ -95,68 +95,6 @@ namespace SkiaSharp
|
|||
#endif
|
||||
}
|
||||
|
||||
// OBSOLETE CREATION
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create() instead.")]
|
||||
public static GRGlInterface CreateDefaultInterface () =>
|
||||
Create ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create() instead.")]
|
||||
public static GRGlInterface CreateNativeGlInterface () =>
|
||||
CreateGl ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create() instead.")]
|
||||
public static GRGlInterface CreateNativeAngleInterface () =>
|
||||
CreateAngle ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateEvas(IntPtr) instead.")]
|
||||
public static GRGlInterface CreateNativeEvasInterface (IntPtr evas) =>
|
||||
CreateEvas (evas);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleInterface (GRGlGetProcDelegate get) =>
|
||||
Create (name => get (null, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleInterface (object context, GRGlGetProcDelegate get) =>
|
||||
Create (name => get (context, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateAngle(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleAngleInterface (GRGlGetProcDelegate get) =>
|
||||
CreateAngle (name => get (null, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateAngle(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleAngleInterface (object context, GRGlGetProcDelegate get) =>
|
||||
CreateAngle (name => get (context, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateOpenGl(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleGlInterface (GRGlGetProcDelegate get) =>
|
||||
CreateOpenGl (name => get (null, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateOpenGl(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleGlInterface (object context, GRGlGetProcDelegate get) =>
|
||||
CreateOpenGl (name => get (context, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateGles(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleGlesInterface (GRGlGetProcDelegate get) =>
|
||||
CreateGles (name => get (null, name));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateGles(GRGlGetProcedureAddressDelegate) instead.")]
|
||||
public static GRGlInterface AssembleGlesInterface (object context, GRGlGetProcDelegate get) =>
|
||||
CreateGles (name => get (context, name));
|
||||
|
||||
//
|
||||
|
||||
public bool Validate () =>
|
||||
|
|
|
@ -4,38 +4,6 @@ using System.IO;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public enum SKBitmapResizeMethod
|
||||
{
|
||||
Box,
|
||||
Triangle,
|
||||
Lanczos3,
|
||||
Hamming,
|
||||
Mitchell
|
||||
}
|
||||
|
||||
public static partial class SkiaExtensions
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKFilterQuality ToFilterQuality (this SKBitmapResizeMethod method)
|
||||
{
|
||||
switch (method) {
|
||||
case SKBitmapResizeMethod.Box:
|
||||
case SKBitmapResizeMethod.Triangle:
|
||||
return SKFilterQuality.Low;
|
||||
case SKBitmapResizeMethod.Lanczos3:
|
||||
return SKFilterQuality.Medium;
|
||||
case SKBitmapResizeMethod.Hamming:
|
||||
case SKBitmapResizeMethod.Mitchell:
|
||||
return SKFilterQuality.High;
|
||||
default:
|
||||
return SKFilterQuality.Medium;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: keep in mind SKBitmap may be going away (according to Google)
|
||||
// TODO: `ComputeIsOpaque` may be useful
|
||||
// TODO: `GenerationID` may be useful
|
||||
|
@ -87,13 +55,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use SKBitmap(SKImageInfo, SKBitmapAllocFlags) instead.")]
|
||||
public SKBitmap (SKImageInfo info, SKColorTable ctable, SKBitmapAllocFlags flags)
|
||||
: this (info, SKBitmapAllocFlags.None)
|
||||
{
|
||||
}
|
||||
|
||||
public SKBitmap (SKImageInfo info, SKBitmapAllocFlags flags)
|
||||
: this ()
|
||||
{
|
||||
|
@ -102,13 +63,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use SKBitmap(SKImageInfo) instead.")]
|
||||
public SKBitmap (SKImageInfo info, SKColorTable ctable)
|
||||
: this (info, SKBitmapAllocFlags.None)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing) =>
|
||||
base.Dispose (disposing);
|
||||
|
||||
|
@ -160,24 +114,6 @@ namespace SkiaSharp
|
|||
SkiaApi.sk_bitmap_erase_rect (Handle, (uint)color, &rect);
|
||||
}
|
||||
|
||||
// GetAddr*
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public byte GetAddr8 (int x, int y) => *SkiaApi.sk_bitmap_get_addr_8 (Handle, x, y);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public UInt16 GetAddr16 (int x, int y) => *SkiaApi.sk_bitmap_get_addr_16 (Handle, x, y);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public UInt32 GetAddr32 (int x, int y) => *SkiaApi.sk_bitmap_get_addr_32 (Handle, x, y);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetAddress instead.")]
|
||||
public IntPtr GetAddr (int x, int y) => GetAddress (x, y);
|
||||
|
||||
// GetAddress
|
||||
|
||||
public IntPtr GetAddress (int x, int y) =>
|
||||
|
@ -185,13 +121,6 @@ namespace SkiaSharp
|
|||
|
||||
// Pixels (color)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixel(int, int) instead.")]
|
||||
public SKPMColor GetIndex8Color (int x, int y)
|
||||
{
|
||||
return (SKPMColor)GetPixel (x, y);
|
||||
}
|
||||
|
||||
public SKColor GetPixel (int x, int y)
|
||||
{
|
||||
return SkiaApi.sk_bitmap_get_pixel_color (Handle, x, y);
|
||||
|
@ -366,9 +295,9 @@ namespace SkiaSharp
|
|||
public IntPtr GetPixels () =>
|
||||
GetPixels (out _);
|
||||
|
||||
public ReadOnlySpan<byte> GetPixelSpan ()
|
||||
public Span<byte> GetPixelSpan ()
|
||||
{
|
||||
return new ReadOnlySpan<byte> ((void*)GetPixels (out var length), (int)length);
|
||||
return new Span<byte> ((void*)GetPixels (out var length), (int)length);
|
||||
}
|
||||
|
||||
public IntPtr GetPixels (out IntPtr length)
|
||||
|
@ -383,22 +312,6 @@ namespace SkiaSharp
|
|||
SkiaApi.sk_bitmap_set_pixels (Handle, (void*)pixels);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use SetPixels(IntPtr) instead.")]
|
||||
public void SetPixels (IntPtr pixels, SKColorTable ct)
|
||||
{
|
||||
SetPixels (pixels);
|
||||
}
|
||||
|
||||
// SetColorTable
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported.")]
|
||||
public void SetColorTable (SKColorTable ct)
|
||||
{
|
||||
// no-op due to unsupperted action
|
||||
}
|
||||
|
||||
// more properties
|
||||
|
||||
public byte[] Bytes {
|
||||
|
@ -459,16 +372,6 @@ namespace SkiaSharp
|
|||
get { return SkiaApi.sk_bitmap_is_immutable (Handle); }
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public bool IsVolatile {
|
||||
get => false;
|
||||
set { }
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported.")]
|
||||
public SKColorTable ColorTable => null;
|
||||
|
||||
// DecodeBounds
|
||||
|
||||
public static SKImageInfo DecodeBounds (Stream stream)
|
||||
|
@ -694,20 +597,6 @@ namespace SkiaSharp
|
|||
return InstallPixels (info, pixels, rowBytes, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use InstallPixels(SKImageInfo, IntPtr, int) instead.")]
|
||||
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable)
|
||||
{
|
||||
return InstallPixels (info, pixels, rowBytes, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use InstallPixels(SKImageInfo, IntPtr, int, SKBitmapReleaseDelegate, object) instead.")]
|
||||
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable, SKBitmapReleaseDelegate releaseProc, object context)
|
||||
{
|
||||
return InstallPixels (info, pixels, rowBytes, releaseProc, context);
|
||||
}
|
||||
|
||||
public bool InstallPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKBitmapReleaseDelegate releaseProc)
|
||||
{
|
||||
return InstallPixels (info, pixels, rowBytes, releaseProc, null);
|
||||
|
@ -769,21 +658,6 @@ namespace SkiaSharp
|
|||
|
||||
// Resize
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Resize(SKImageInfo, SKFilterQuality) instead.")]
|
||||
public SKBitmap Resize (SKImageInfo info, SKBitmapResizeMethod method) =>
|
||||
Resize (info, method.ToFilterQuality ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ScalePixels(SKBitmap, SKFilterQuality) instead.")]
|
||||
public bool Resize (SKBitmap dst, SKBitmapResizeMethod method) =>
|
||||
ScalePixels (dst, method.ToFilterQuality ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ScalePixels(SKBitmap, SKFilterQuality) instead.")]
|
||||
public static bool Resize (SKBitmap dst, SKBitmap src, SKBitmapResizeMethod method) =>
|
||||
src.ScalePixels (dst, method.ToFilterQuality ());
|
||||
|
||||
public SKBitmap Resize (SKImageInfo info, SKFilterQuality quality)
|
||||
{
|
||||
if (info.IsEmpty)
|
||||
|
|
|
@ -611,122 +611,6 @@ namespace SkiaSharp
|
|||
DrawText (blob, x, y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawText (byte[] text, SKPoint p, SKPaint paint)
|
||||
{
|
||||
DrawText (text, p.X, p.Y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawText (byte[] text, float x, float y, SKPaint paint)
|
||||
{
|
||||
if (text == null)
|
||||
throw new ArgumentNullException (nameof (text));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
|
||||
if (paint.TextAlign != SKTextAlign.Left) {
|
||||
var width = paint.MeasureText (text);
|
||||
if (paint.TextAlign == SKTextAlign.Center)
|
||||
width *= 0.5f;
|
||||
x -= width;
|
||||
}
|
||||
|
||||
using var blob = SKTextBlob.Create (text, paint.TextEncoding, paint.GetFont ());
|
||||
if (blob == null)
|
||||
return;
|
||||
|
||||
DrawText (blob, x, y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawText (IntPtr buffer, int length, SKPoint p, SKPaint paint)
|
||||
{
|
||||
DrawText (buffer, length, p.X, p.Y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawText (IntPtr buffer, int length, float x, float y, SKPaint paint)
|
||||
{
|
||||
if (buffer == IntPtr.Zero && length != 0)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
|
||||
if (paint.TextAlign != SKTextAlign.Left) {
|
||||
var width = paint.MeasureText (buffer, length);
|
||||
if (paint.TextAlign == SKTextAlign.Center)
|
||||
width *= 0.5f;
|
||||
x -= width;
|
||||
}
|
||||
|
||||
using var blob = SKTextBlob.Create (buffer, length, paint.TextEncoding, paint.GetFont ());
|
||||
if (blob == null)
|
||||
return;
|
||||
|
||||
DrawText (blob, x, y, paint);
|
||||
}
|
||||
|
||||
// DrawPositionedText
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawPositionedText (string text, SKPoint[] points, SKPaint paint)
|
||||
{
|
||||
if (text == null)
|
||||
throw new ArgumentNullException (nameof (text));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
if (points == null)
|
||||
throw new ArgumentNullException (nameof (points));
|
||||
|
||||
using var blob = SKTextBlob.CreatePositioned (text, paint.GetFont (), points);
|
||||
if (blob == null)
|
||||
return;
|
||||
|
||||
DrawText (blob, 0, 0, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawPositionedText (byte[] text, SKPoint[] points, SKPaint paint)
|
||||
{
|
||||
if (text == null)
|
||||
throw new ArgumentNullException (nameof (text));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
if (points == null)
|
||||
throw new ArgumentNullException (nameof (points));
|
||||
|
||||
using var blob = SKTextBlob.CreatePositioned (text, paint.TextEncoding, paint.GetFont (), points);
|
||||
if (blob == null)
|
||||
return;
|
||||
|
||||
DrawText (blob, 0, 0, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawText(SKTextBlob, float, float, SKPaint) instead.")]
|
||||
public void DrawPositionedText (IntPtr buffer, int length, SKPoint[] points, SKPaint paint)
|
||||
{
|
||||
if (buffer == IntPtr.Zero && length != 0)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
if (points == null)
|
||||
throw new ArgumentNullException (nameof (points));
|
||||
|
||||
using var blob = SKTextBlob.CreatePositioned (buffer, length, paint.TextEncoding, paint.GetFont (), points);
|
||||
if (blob == null)
|
||||
return;
|
||||
|
||||
DrawText (blob, 0, 0, paint);
|
||||
}
|
||||
|
||||
// DrawTextOnPath
|
||||
|
||||
public void DrawTextOnPath (string text, SKPath path, SKPoint offset, SKPaint paint)
|
||||
|
@ -768,53 +652,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawTextOnPath(string, SKPath, SKPoint, SKPaint) instead.")]
|
||||
public void DrawTextOnPath (byte[] text, SKPath path, SKPoint offset, SKPaint paint)
|
||||
{
|
||||
DrawTextOnPath (text, path, offset.X, offset.Y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawTextOnPath(string, SKPath, float, float, SKPaint) instead.")]
|
||||
public void DrawTextOnPath (byte[] text, SKPath path, float hOffset, float vOffset, SKPaint paint)
|
||||
{
|
||||
if (text == null)
|
||||
throw new ArgumentNullException (nameof (text));
|
||||
if (path == null)
|
||||
throw new ArgumentNullException (nameof (path));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
|
||||
fixed (byte* t = text) {
|
||||
DrawTextOnPath ((IntPtr)t, text.Length, path, hOffset, vOffset, paint);
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawTextOnPath(string, SKPath, SKPoint, SKPaint) instead.")]
|
||||
public void DrawTextOnPath (IntPtr buffer, int length, SKPath path, SKPoint offset, SKPaint paint)
|
||||
{
|
||||
DrawTextOnPath (buffer, length, path, offset.X, offset.Y, paint);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use DrawTextOnPath(string, SKPath, float, float, SKPaint) instead.")]
|
||||
public void DrawTextOnPath (IntPtr buffer, int length, SKPath path, float hOffset, float vOffset, SKPaint paint)
|
||||
{
|
||||
if (buffer == IntPtr.Zero && length != 0)
|
||||
throw new ArgumentNullException (nameof (buffer));
|
||||
if (path == null)
|
||||
throw new ArgumentNullException (nameof (path));
|
||||
if (paint == null)
|
||||
throw new ArgumentNullException (nameof (paint));
|
||||
|
||||
var font = paint.GetFont ();
|
||||
|
||||
using var textPath = font.GetTextPathOnPath (buffer, length, paint.TextEncoding, path, paint.TextAlign, new SKPoint (hOffset, vOffset));
|
||||
DrawPath (textPath, paint);
|
||||
}
|
||||
|
||||
// Flush
|
||||
|
||||
public void Flush ()
|
||||
|
|
|
@ -31,11 +31,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use EncodedOrigin instead.")]
|
||||
public SKCodecOrigin Origin =>
|
||||
(SKCodecOrigin)EncodedOrigin;
|
||||
|
||||
public SKEncodedOrigin EncodedOrigin =>
|
||||
SkiaApi.sk_codec_get_origin (Handle);
|
||||
|
||||
|
@ -139,36 +134,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_codec_get_pixels (Handle, &nInfo, (void*)pixels, (IntPtr)rowBytes, &nOptions);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr, int, SKCodecOptions) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, rowBytes, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr, SKCodecOptions) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, info.RowBytes, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, IntPtr colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, info.RowBytes, SKCodecOptions.Default);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr, int, SKCodecOptions) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, rowBytes, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr, SKCodecOptions) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, info.RowBytes, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use GetPixels(SKImageInfo, IntPtr) instead.")]
|
||||
public SKCodecResult GetPixels (SKImageInfo info, IntPtr pixels, SKColorTable colorTable, ref int colorTableCount) =>
|
||||
GetPixels (info, pixels, info.RowBytes, SKCodecOptions.Default);
|
||||
|
||||
// incremental (start)
|
||||
|
||||
public SKCodecResult StartIncrementalDecode (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options)
|
||||
|
@ -198,16 +163,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_codec_start_incremental_decode (Handle, &cinfo, (void*)pixels, (IntPtr)rowBytes, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use StartIncrementalDecode(SKImageInfo, IntPtr, int, SKCodecOptions) instead.")]
|
||||
public SKCodecResult StartIncrementalDecode (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount) =>
|
||||
StartIncrementalDecode (info, pixels, rowBytes, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use StartIncrementalDecode(SKImageInfo, IntPtr, int, SKCodecOptions) instead.")]
|
||||
public SKCodecResult StartIncrementalDecode (SKImageInfo info, IntPtr pixels, int rowBytes, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
|
||||
StartIncrementalDecode (info, pixels, rowBytes, options);
|
||||
|
||||
// incremental (step)
|
||||
|
||||
public SKCodecResult IncrementalDecode (out int rowsDecoded)
|
||||
|
@ -246,16 +201,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_codec_start_scanline_decode (Handle, &cinfo, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use StartScanlineDecode(SKImageInfo, SKCodecOptions) instead.")]
|
||||
public SKCodecResult StartScanlineDecode (SKImageInfo info, SKCodecOptions options, IntPtr colorTable, ref int colorTableCount) =>
|
||||
StartScanlineDecode (info, options);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use StartScanlineDecode(SKImageInfo, SKCodecOptions) instead.")]
|
||||
public SKCodecResult StartScanlineDecode (SKImageInfo info, SKCodecOptions options, SKColorTable colorTable, ref int colorTableCount) =>
|
||||
StartScanlineDecode (info, options);
|
||||
|
||||
// scanline (step)
|
||||
|
||||
public int GetScanlines (IntPtr dst, int countLines, int rowBytes)
|
||||
|
|
|
@ -45,26 +45,6 @@ namespace SkiaSharp
|
|||
public bool IsSrgb =>
|
||||
SkiaApi.sk_colorspace_is_srgb (Handle);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKColorSpaceType Type => SKColorSpaceType.Rgb;
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetNumericalTransferFunction() instead.")]
|
||||
public SKNamedGamma NamedGamma {
|
||||
get {
|
||||
var tf = GetNumericalTransferFunction ();
|
||||
return tf switch
|
||||
{
|
||||
_ when tf == SKColorSpaceTransferFn.Empty => SKNamedGamma.NonStandard,
|
||||
_ when tf == SKColorSpaceTransferFn.Linear => SKNamedGamma.Linear,
|
||||
_ when tf == SKColorSpaceTransferFn.Srgb => SKNamedGamma.Srgb,
|
||||
_ when tf == SKColorSpaceTransferFn.TwoDotTwo => SKNamedGamma.TwoDotTwoCurve,
|
||||
_ => SKNamedGamma.NonStandard,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNumericalTransferFunction =>
|
||||
GetNumericalTransferFunction (out _);
|
||||
|
||||
|
@ -120,73 +100,6 @@ namespace SkiaSharp
|
|||
|
||||
// CreateRgb
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceRenderTargetGamma gamma, SKMatrix44 toXyzD50, SKColorSpaceFlags flags) =>
|
||||
CreateRgb (gamma, toXyzD50);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceRenderTargetGamma gamma, SKColorSpaceGamut gamut, SKColorSpaceFlags flags) =>
|
||||
CreateRgb (gamma, gamut);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceTransferFn coeffs, SKMatrix44 toXyzD50, SKColorSpaceFlags flags) =>
|
||||
CreateRgb (coeffs, toXyzD50);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceTransferFn coeffs, SKColorSpaceGamut gamut, SKColorSpaceFlags flags) =>
|
||||
CreateRgb (coeffs, gamut);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceRenderTargetGamma gamma, SKMatrix44 toXyzD50)
|
||||
{
|
||||
if (toXyzD50 == null)
|
||||
throw new ArgumentNullException (nameof (toXyzD50));
|
||||
|
||||
return CreateRgb (gamma.ToColorSpaceTransferFn (), toXyzD50.ToColorSpaceXyz ());
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceRenderTargetGamma gamma, SKColorSpaceGamut gamut) =>
|
||||
CreateRgb (gamma.ToColorSpaceTransferFn (), gamut.ToColorSpaceXyz ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceTransferFn coeffs, SKMatrix44 toXyzD50)
|
||||
{
|
||||
if (toXyzD50 == null)
|
||||
throw new ArgumentNullException (nameof (toXyzD50));
|
||||
|
||||
return CreateRgb (coeffs, toXyzD50.ToColorSpaceXyz ());
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceTransferFn coeffs, SKColorSpaceGamut gamut) =>
|
||||
CreateRgb (coeffs, gamut.ToColorSpaceXyz ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKNamedGamma gamma, SKMatrix44 toXyzD50)
|
||||
{
|
||||
if (toXyzD50 == null)
|
||||
throw new ArgumentNullException (nameof (toXyzD50));
|
||||
|
||||
return CreateRgb (gamma.ToColorSpaceTransferFn (), toXyzD50.ToColorSpaceXyz ());
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRgb(SKColorSpaceTransferFn, SKColorSpaceXyz) instead.")]
|
||||
public static SKColorSpace CreateRgb (SKNamedGamma gamma, SKColorSpaceGamut gamut) =>
|
||||
CreateRgb (gamma.ToColorSpaceTransferFn (), gamut.ToColorSpaceXyz ());
|
||||
|
||||
// CreateRgb
|
||||
|
||||
public static SKColorSpace CreateRgb (SKColorSpaceTransferFn transferFn, SKColorSpaceXyz toXyzD50) =>
|
||||
GetObject (SkiaApi.sk_colorspace_new_rgb (&transferFn, &toXyzD50));
|
||||
|
||||
|
@ -231,32 +144,6 @@ namespace SkiaSharp
|
|||
public SKColorSpace ToSrgbGamma () =>
|
||||
GetObject (SkiaApi.sk_colorspace_make_srgb_gamma (Handle));
|
||||
|
||||
// *XyzD50
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ToColorSpaceXyz() instead.")]
|
||||
public SKMatrix44 ToXyzD50 () =>
|
||||
ToColorSpaceXyz ().ToMatrix44 ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ToColorSpaceXyz(out SKColorSpaceXyz) instead.")]
|
||||
public bool ToXyzD50 (SKMatrix44 toXyzD50)
|
||||
{
|
||||
if (toXyzD50 == null)
|
||||
throw new ArgumentNullException (nameof (toXyzD50));
|
||||
|
||||
if (ToColorSpaceXyz (out var xyz) && xyz.ToMatrix44 () is SKMatrix44 m) {
|
||||
toXyzD50.SetColumnMajor (m.ToColumnMajor ());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKMatrix44 FromXyzD50 () =>
|
||||
ToXyzD50 ()?.Invert ();
|
||||
|
||||
//
|
||||
|
||||
internal static SKColorSpace GetObject (IntPtr handle, bool owns = true, bool unrefExisting = true) =>
|
||||
|
|
|
@ -3,94 +3,6 @@ using System.ComponentModel;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorSpaceTransferFn instead.")]
|
||||
public enum SKColorSpaceRenderTargetGamma
|
||||
{
|
||||
Linear = 0,
|
||||
Srgb = 1,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorSpaceXyz instead.")]
|
||||
public enum SKColorSpaceGamut
|
||||
{
|
||||
AdobeRgb = 1,
|
||||
Dcip3D65 = 2,
|
||||
Rec2020 = 3,
|
||||
Srgb = 0,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public enum SKColorSpaceType
|
||||
{
|
||||
Cmyk = 1,
|
||||
Gray = 2,
|
||||
Rgb = 0,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorSpaceTransferFn instead.")]
|
||||
public enum SKNamedGamma
|
||||
{
|
||||
Linear = 0,
|
||||
Srgb = 1,
|
||||
TwoDotTwoCurve = 2,
|
||||
NonStandard = 3,
|
||||
}
|
||||
|
||||
public partial class SkiaExtensions
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKColorSpaceTransferFn ToColorSpaceTransferFn (this SKColorSpaceRenderTargetGamma gamma) =>
|
||||
gamma switch
|
||||
{
|
||||
SKColorSpaceRenderTargetGamma.Linear => SKColorSpaceTransferFn.Linear,
|
||||
SKColorSpaceRenderTargetGamma.Srgb => SKColorSpaceTransferFn.Srgb,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (gamma)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKColorSpaceTransferFn ToColorSpaceTransferFn (this SKNamedGamma gamma) =>
|
||||
gamma switch
|
||||
{
|
||||
SKNamedGamma.Linear => SKColorSpaceTransferFn.Linear,
|
||||
SKNamedGamma.Srgb => SKColorSpaceTransferFn.Srgb,
|
||||
SKNamedGamma.TwoDotTwoCurve => SKColorSpaceTransferFn.TwoDotTwo,
|
||||
SKNamedGamma.NonStandard => SKColorSpaceTransferFn.Empty,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (gamma)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKColorSpaceXyz ToColorSpaceXyz (this SKColorSpaceGamut gamut) =>
|
||||
gamut switch
|
||||
{
|
||||
SKColorSpaceGamut.AdobeRgb => SKColorSpaceXyz.AdobeRgb,
|
||||
SKColorSpaceGamut.Dcip3D65 => SKColorSpaceXyz.Dcip3,
|
||||
SKColorSpaceGamut.Rec2020 => SKColorSpaceXyz.Rec2020,
|
||||
SKColorSpaceGamut.Srgb => SKColorSpaceXyz.Srgb,
|
||||
_ => throw new ArgumentOutOfRangeException (nameof (gamut)),
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKColorSpaceXyz ToColorSpaceXyz (this SKMatrix44 matrix)
|
||||
{
|
||||
if (matrix == null)
|
||||
throw new ArgumentNullException (nameof (matrix));
|
||||
|
||||
var values = matrix.ToRowMajor ();
|
||||
return new SKColorSpaceXyz (
|
||||
values[0], values[1], values[2],
|
||||
values[4], values[5], values[6],
|
||||
values[8], values[9], values[10]);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe partial struct SKColorSpacePrimaries
|
||||
{
|
||||
public static readonly SKColorSpacePrimaries Empty;
|
||||
|
@ -127,24 +39,6 @@ namespace SkiaSharp
|
|||
public readonly float[] Values =>
|
||||
new[] { fRX, fRY, fGX, fGY, fBX, fBY, fWX, fWY };
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ToColorSpaceXyz() instead.")]
|
||||
public readonly SKMatrix44 ToXyzD50 () =>
|
||||
ToMatrix44 ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ToColorSpaceXyz(out SKColorSpaceXyz) instead.")]
|
||||
public readonly bool ToXyzD50 (SKMatrix44 toXyzD50)
|
||||
{
|
||||
if (toXyzD50 == null)
|
||||
throw new ArgumentNullException (nameof (toXyzD50));
|
||||
|
||||
var xyz = ToMatrix44 ();
|
||||
if (xyz != null)
|
||||
toXyzD50.SetColumnMajor (xyz.ToColumnMajor ());
|
||||
return xyz != null;
|
||||
}
|
||||
|
||||
internal readonly SKMatrix44 ToMatrix44 () =>
|
||||
ToMatrix44 (out var toXYZ) ? toXYZ : null;
|
||||
|
||||
|
@ -288,9 +182,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete ("Use DisplayP3 instead.")]
|
||||
public static SKColorSpaceXyz Dcip3 => DisplayP3;
|
||||
|
||||
public static SKColorSpaceXyz DisplayP3 {
|
||||
get {
|
||||
SKColorSpaceXyz xyz;
|
||||
|
@ -317,6 +208,12 @@ namespace SkiaSharp
|
|||
|
||||
public static readonly SKColorSpaceXyz Empty;
|
||||
|
||||
public readonly static SKColorSpaceXyz Identity =
|
||||
new SKColorSpaceXyz(
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
0, 0, 1);
|
||||
|
||||
public SKColorSpaceXyz (float value)
|
||||
{
|
||||
fM00 = value;
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported.")]
|
||||
public unsafe class SKColorTable : SKObject, ISKReferenceCounted, ISKSkipObjectRegistration
|
||||
{
|
||||
public const int MaxLength = 256;
|
||||
|
||||
internal SKColorTable (IntPtr x, bool owns)
|
||||
: base (x, owns)
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable ()
|
||||
: this (new SKPMColor[MaxLength])
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable (int count)
|
||||
: this (new SKPMColor[count])
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable (SKColor[] colors)
|
||||
: this (colors, colors.Length)
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable (SKColor[] colors, int count)
|
||||
: this (SKPMColor.PreMultiply (colors), count)
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable (SKPMColor[] colors)
|
||||
: this (colors, colors.Length)
|
||||
{
|
||||
}
|
||||
|
||||
public SKColorTable (SKPMColor[] colors, int count)
|
||||
: this (CreateNew (colors, count), true)
|
||||
{
|
||||
if (Handle == IntPtr.Zero) {
|
||||
throw new InvalidOperationException ("Unable to create a new SKColorTable instance.");
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr CreateNew (SKPMColor[] colors, int count)
|
||||
{
|
||||
fixed (SKPMColor* c = colors) {
|
||||
return SkiaApi.sk_colortable_new ((uint*)c, count);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing) =>
|
||||
base.Dispose (disposing);
|
||||
|
||||
public int Count => SkiaApi.sk_colortable_count (Handle);
|
||||
|
||||
public SKPMColor[] Colors {
|
||||
get {
|
||||
var count = Count;
|
||||
var pointer = ReadColors ();
|
||||
|
||||
if (count == 0 || pointer == IntPtr.Zero) {
|
||||
return new SKPMColor[0];
|
||||
}
|
||||
|
||||
return PtrToStructureArray<SKPMColor> (pointer, count);
|
||||
}
|
||||
}
|
||||
|
||||
public SKColor[] UnPreMultipledColors => SKPMColor.UnPreMultiply (Colors);
|
||||
|
||||
public SKPMColor this[int index] {
|
||||
get {
|
||||
var count = Count;
|
||||
var pointer = ReadColors ();
|
||||
|
||||
if (index < 0 || index >= count || pointer == IntPtr.Zero) {
|
||||
throw new ArgumentOutOfRangeException (nameof (index));
|
||||
}
|
||||
|
||||
return PtrToStructure<SKPMColor> (pointer, index);
|
||||
}
|
||||
}
|
||||
|
||||
public SKColor GetUnPreMultipliedColor (int index) => SKPMColor.UnPreMultiply (this[index]);
|
||||
|
||||
public IntPtr ReadColors ()
|
||||
{
|
||||
uint* colors;
|
||||
SkiaApi.sk_colortable_read_colors (Handle, &colors);
|
||||
return (IntPtr)colors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,14 +73,6 @@ namespace SkiaSharp
|
|||
|
||||
// CreatePdf
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreatePdf(SKWStream, SKDocumentPdfMetadata) instead.")]
|
||||
public static SKDocument CreatePdf (SKWStream stream, SKDocumentPdfMetadata metadata, float dpi)
|
||||
{
|
||||
metadata.RasterDpi = dpi;
|
||||
return CreatePdf (stream, metadata);
|
||||
}
|
||||
|
||||
public static SKDocument CreatePdf (string path)
|
||||
{
|
||||
if (path == null) {
|
||||
|
|
|
@ -82,11 +82,6 @@ namespace SkiaSharp
|
|||
return GetObject (SkiaApi.sk_image_new_raster_copy (&nInfo, (void*)pixels, (IntPtr)rowBytes));
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use FromPixelCopy(SKImageInfo, IntPtr, int) instead.")]
|
||||
public static SKImage FromPixelCopy (SKImageInfo info, IntPtr pixels, int rowBytes, SKColorTable ctable) =>
|
||||
FromPixelCopy (info, pixels, rowBytes);
|
||||
|
||||
public static SKImage FromPixelCopy (SKPixmap pixmap)
|
||||
{
|
||||
if (pixmap == null)
|
||||
|
@ -108,16 +103,6 @@ namespace SkiaSharp
|
|||
|
||||
// create a new image around existing pixel data
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromPixels (SKImageInfo, SKData, int) instead.")]
|
||||
public static SKImage FromPixelData (SKImageInfo info, SKData data, int rowBytes)
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentNullException (nameof (data));
|
||||
var cinfo = SKImageInfoNative.FromManaged (ref info);
|
||||
return GetObject (SkiaApi.sk_image_new_raster_data (&cinfo, data.Handle, (IntPtr)rowBytes));
|
||||
}
|
||||
|
||||
public static SKImage FromPixels (SKImageInfo info, SKData data) =>
|
||||
FromPixels (info, data, info.RowBytes);
|
||||
|
||||
|
@ -258,67 +243,6 @@ namespace SkiaSharp
|
|||
|
||||
// create a new image from a GPU texture
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRBackendTextureDesc desc)
|
||||
{
|
||||
return FromTexture (context, desc, SKAlphaType.Premul, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRBackendTextureDesc desc, SKAlphaType alpha)
|
||||
{
|
||||
return FromTexture (context, desc, alpha, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRBackendTextureDesc desc, SKAlphaType alpha, SKImageTextureReleaseDelegate releaseProc)
|
||||
{
|
||||
return FromTexture (context, desc, alpha, releaseProc, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate, object) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRBackendTextureDesc desc, SKAlphaType alpha, SKImageTextureReleaseDelegate releaseProc, object releaseContext)
|
||||
{
|
||||
if (context == null)
|
||||
throw new ArgumentNullException (nameof (context));
|
||||
|
||||
var texture = new GRBackendTexture (desc);
|
||||
return FromTexture (context, texture, desc.Origin, desc.Config.ToColorType (), alpha, null, releaseProc, releaseContext);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRGlBackendTextureDesc desc)
|
||||
{
|
||||
return FromTexture (context, desc, SKAlphaType.Premul, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRGlBackendTextureDesc desc, SKAlphaType alpha)
|
||||
{
|
||||
return FromTexture (context, desc, alpha, null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRGlBackendTextureDesc desc, SKAlphaType alpha, SKImageTextureReleaseDelegate releaseProc)
|
||||
{
|
||||
return FromTexture (context, desc, alpha, releaseProc, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate, object) instead.")]
|
||||
public static SKImage FromTexture (GRContext context, GRGlBackendTextureDesc desc, SKAlphaType alpha, SKImageTextureReleaseDelegate releaseProc, object releaseContext)
|
||||
{
|
||||
var texture = new GRBackendTexture (desc);
|
||||
return FromTexture (context, texture, desc.Origin, desc.Config.ToColorType (), alpha, null, releaseProc, releaseContext);
|
||||
}
|
||||
|
||||
public static SKImage FromTexture (GRContext context, GRBackendTexture texture, SKColorType colorType) =>
|
||||
FromTexture ((GRRecordingContext)context, texture, colorType);
|
||||
|
||||
|
@ -367,36 +291,6 @@ namespace SkiaSharp
|
|||
return GetObject (SkiaApi.sk_image_new_from_texture (context.Handle, texture.Handle, origin, colorType.ToNative (), alpha, cs, proxy, (void*)ctx));
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKImage FromAdoptedTexture (GRContext context, GRBackendTextureDesc desc)
|
||||
{
|
||||
return FromAdoptedTexture (context, desc, SKAlphaType.Premul);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType) instead.")]
|
||||
public static SKImage FromAdoptedTexture (GRContext context, GRBackendTextureDesc desc, SKAlphaType alpha)
|
||||
{
|
||||
var texture = new GRBackendTexture (desc);
|
||||
return FromAdoptedTexture (context, texture, desc.Origin, desc.Config.ToColorType (), alpha, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKImage FromAdoptedTexture (GRContext context, GRGlBackendTextureDesc desc)
|
||||
{
|
||||
return FromAdoptedTexture (context, desc, SKAlphaType.Premul);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType) instead.")]
|
||||
public static SKImage FromAdoptedTexture (GRContext context, GRGlBackendTextureDesc desc, SKAlphaType alpha)
|
||||
{
|
||||
var texture = new GRBackendTexture (desc);
|
||||
return FromAdoptedTexture (context, texture, desc.Origin, desc.Config.ToColorType (), alpha, null);
|
||||
}
|
||||
|
||||
public static SKImage FromAdoptedTexture (GRContext context, GRBackendTexture texture, SKColorType colorType) =>
|
||||
FromAdoptedTexture ((GRRecordingContext)context, texture, colorType);
|
||||
|
||||
|
@ -455,46 +349,6 @@ namespace SkiaSharp
|
|||
public SKData Encode () =>
|
||||
SKData.GetObject (SkiaApi.sk_image_encode (Handle));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKData Encode (SKPixelSerializer serializer)
|
||||
{
|
||||
if (serializer == null)
|
||||
throw new ArgumentNullException (nameof (serializer));
|
||||
|
||||
// try old data
|
||||
var encoded = EncodedData;
|
||||
if (encoded != null) {
|
||||
if (serializer.UseEncodedData (encoded.Data, (ulong)encoded.Size)) {
|
||||
return encoded;
|
||||
} else {
|
||||
encoded.Dispose ();
|
||||
encoded = null;
|
||||
}
|
||||
}
|
||||
|
||||
// get new data (raster)
|
||||
if (!IsTextureBacked) {
|
||||
using (var pixmap = PeekPixels ()) {
|
||||
return serializer.Encode (pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
// get new data (texture / gpu)
|
||||
// this involves a copy from gpu to cpu first
|
||||
if (IsTextureBacked) {
|
||||
var info = new SKImageInfo (Width, Height, ColorType, AlphaType, ColorSpace);
|
||||
using var temp = new SKBitmap (info);
|
||||
using var pixmap = temp.PeekPixels ();
|
||||
if (pixmap != null && ReadPixels (pixmap, 0, 0)) {
|
||||
return serializer.Encode (pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
// some error
|
||||
return null;
|
||||
}
|
||||
|
||||
public SKData Encode (SKEncodedImageFormat format, int quality)
|
||||
{
|
||||
return SKData.GetObject (SkiaApi.sk_image_encode_specific (Handle, format, quality));
|
||||
|
@ -644,11 +498,6 @@ namespace SkiaSharp
|
|||
public SKImage ToTextureImage (GRContext context) =>
|
||||
ToTextureImage (context, false);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ToTextureImage(GRContext) instead.")]
|
||||
public SKImage ToTextureImage (GRContext context, SKColorSpace colorspace) =>
|
||||
ToTextureImage (context, false);
|
||||
|
||||
public SKImage ToTextureImage (GRContext context, bool mipmapped)
|
||||
{
|
||||
if (context == null)
|
||||
|
|
|
@ -8,60 +8,6 @@ namespace SkiaSharp
|
|||
// TODO: `cropRectIsSet`, `getCropRect`
|
||||
// TODO: `computeFastBounds`, `canComputeFastBounds`
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorChannel instead.")]
|
||||
public enum SKDisplacementMapEffectChannelSelectorType
|
||||
{
|
||||
Unknown = 0,
|
||||
R = 1,
|
||||
G = 2,
|
||||
B = 3,
|
||||
A = 4,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateDropShadow or CreateDropShadowOnly instead.")]
|
||||
public enum SKDropShadowImageFilterShadowMode
|
||||
{
|
||||
DrawShadowAndForeground = 0,
|
||||
DrawShadowOnly = 1,
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKShaderTileMode instead.")]
|
||||
public enum SKMatrixConvolutionTileMode
|
||||
{
|
||||
Clamp = 0,
|
||||
Repeat = 1,
|
||||
ClampToBlack = 2,
|
||||
|
||||
}
|
||||
|
||||
public static partial class SkiaExtensions
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKColorChannel instead.")]
|
||||
public static SKColorChannel ToColorChannel (this SKDisplacementMapEffectChannelSelectorType channelSelectorType) =>
|
||||
channelSelectorType switch
|
||||
{
|
||||
SKDisplacementMapEffectChannelSelectorType.R => SKColorChannel.R,
|
||||
SKDisplacementMapEffectChannelSelectorType.G => SKColorChannel.G,
|
||||
SKDisplacementMapEffectChannelSelectorType.B => SKColorChannel.B,
|
||||
SKDisplacementMapEffectChannelSelectorType.A => SKColorChannel.A,
|
||||
_ => SKColorChannel.B,
|
||||
};
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SKShaderTileMode instead.")]
|
||||
public static SKShaderTileMode ToShaderTileMode (this SKMatrixConvolutionTileMode tileMode) =>
|
||||
tileMode switch
|
||||
{
|
||||
SKMatrixConvolutionTileMode.Clamp => SKShaderTileMode.Clamp,
|
||||
SKMatrixConvolutionTileMode.Repeat => SKShaderTileMode.Repeat,
|
||||
_ => SKShaderTileMode.Decal,
|
||||
};
|
||||
}
|
||||
|
||||
public unsafe class SKImageFilter : SKObject, ISKReferenceCounted
|
||||
{
|
||||
internal SKImageFilter(IntPtr handle, bool owns)
|
||||
|
@ -126,11 +72,6 @@ namespace SkiaSharp
|
|||
|
||||
// CreateDisplacementMapEffect
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateDisplacementMapEffect(SKColorChannel, SKColorChannel, float, SKImageFilter, SKImageFilter, SKImageFilter.CropRect) instead.")]
|
||||
public static SKImageFilter CreateDisplacementMapEffect (SKDisplacementMapEffectChannelSelectorType xChannelSelector, SKDisplacementMapEffectChannelSelectorType yChannelSelector, float scale, SKImageFilter displacement, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null) =>
|
||||
CreateDisplacementMapEffect (xChannelSelector.ToColorChannel (), yChannelSelector.ToColorChannel (), scale, displacement, input, cropRect);
|
||||
|
||||
public static SKImageFilter CreateDisplacementMapEffect (SKColorChannel xChannelSelector, SKColorChannel yChannelSelector, float scale, SKImageFilter displacement, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
if (displacement == null)
|
||||
|
@ -140,13 +81,6 @@ namespace SkiaSharp
|
|||
|
||||
// CreateDropShadow
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateDropShadow or CreateDropShadowOnly instead.")]
|
||||
public static SKImageFilter CreateDropShadow (float dx, float dy, float sigmaX, float sigmaY, SKColor color, SKDropShadowImageFilterShadowMode shadowMode, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null) =>
|
||||
shadowMode == SKDropShadowImageFilterShadowMode.DrawShadowOnly
|
||||
? CreateDropShadowOnly (dx, dy, sigmaX, sigmaY, color, input, cropRect)
|
||||
: CreateDropShadow (dx, dy, sigmaX, sigmaY, color, input, cropRect);
|
||||
|
||||
public static SKImageFilter CreateDropShadow (float dx, float dy, float sigmaX, float sigmaY, SKColor color, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null) =>
|
||||
GetObject (SkiaApi.sk_imagefilter_new_drop_shadow (dx, dy, sigmaX, sigmaY, (uint)color, input == null ? IntPtr.Zero : input.Handle, cropRect == null ? IntPtr.Zero : cropRect.Handle));
|
||||
|
||||
|
@ -196,11 +130,6 @@ namespace SkiaSharp
|
|||
|
||||
// CreateMatrixConvolution
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateMatrixConvolution(SKSizeI, float[], float, float, SKPointI, SKShaderTileMode, bool, SKImageFilter, SKImageFilter.CropRect) instead.")]
|
||||
public static SKImageFilter CreateMatrixConvolution (SKSizeI kernelSize, float[] kernel, float gain, float bias, SKPointI kernelOffset, SKMatrixConvolutionTileMode tileMode, bool convolveAlpha, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null) =>
|
||||
CreateMatrixConvolution (kernelSize, kernel, gain, bias, kernelOffset, tileMode.ToShaderTileMode (), convolveAlpha, input, cropRect);
|
||||
|
||||
public static SKImageFilter CreateMatrixConvolution (SKSizeI kernelSize, float[] kernel, float gain, float bias, SKPointI kernelOffset, SKShaderTileMode tileMode, bool convolveAlpha, SKImageFilter input = null, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
if (kernel == null)
|
||||
|
@ -214,25 +143,11 @@ namespace SkiaSharp
|
|||
|
||||
// CreateMerge
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use CreateMerge(SKImageFilter, SKImageFilter, SKImageFilter.CropRect) instead.")]
|
||||
public static SKImageFilter CreateMerge(SKImageFilter first, SKImageFilter second, SKBlendMode mode, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
return CreateMerge(new [] { first, second }, cropRect);
|
||||
}
|
||||
|
||||
public static SKImageFilter CreateMerge(SKImageFilter first, SKImageFilter second, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
return CreateMerge(new [] { first, second }, cropRect);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use CreateMerge(SKImageFilter[], SKImageFilter.CropRect) instead.")]
|
||||
public static SKImageFilter CreateMerge(SKImageFilter[] filters, SKBlendMode[] modes, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
return CreateMerge (filters, cropRect);
|
||||
}
|
||||
|
||||
public static SKImageFilter CreateMerge(SKImageFilter[] filters, SKImageFilter.CropRect cropRect = null)
|
||||
{
|
||||
if (filters == null)
|
||||
|
|
|
@ -3,18 +3,6 @@ using System.ComponentModel;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Flags]
|
||||
[Obsolete]
|
||||
public enum SKBlurMaskFilterFlags
|
||||
{
|
||||
None = 0x00,
|
||||
IgnoreTransform = 0x01,
|
||||
HighQuality = 0x02,
|
||||
All = IgnoreTransform | HighQuality,
|
||||
}
|
||||
|
||||
|
||||
// TODO: `getFormat`
|
||||
// TODO: `computeFastBounds`
|
||||
|
||||
|
@ -51,34 +39,6 @@ namespace SkiaSharp
|
|||
return GetObject (SkiaApi.sk_maskfilter_new_blur_with_flags (blurStyle, sigma, respectCTM));
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateBlur(SKBlurStyle, float) instead.")]
|
||||
public static SKMaskFilter CreateBlur (SKBlurStyle blurStyle, float sigma, SKBlurMaskFilterFlags flags)
|
||||
{
|
||||
return CreateBlur (blurStyle, sigma, true);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateBlur(SKBlurStyle, float) instead.")]
|
||||
public static SKMaskFilter CreateBlur (SKBlurStyle blurStyle, float sigma, SKRect occluder)
|
||||
{
|
||||
return CreateBlur (blurStyle, sigma, true);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateBlur(SKBlurStyle, float) instead.")]
|
||||
public static SKMaskFilter CreateBlur (SKBlurStyle blurStyle, float sigma, SKRect occluder, SKBlurMaskFilterFlags flags)
|
||||
{
|
||||
return CreateBlur (blurStyle, sigma, true);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateBlur(SKBlurStyle, float, bool) instead.")]
|
||||
public static SKMaskFilter CreateBlur (SKBlurStyle blurStyle, float sigma, SKRect occluder, bool respectCTM)
|
||||
{
|
||||
return CreateBlur (blurStyle, sigma, respectCTM);
|
||||
}
|
||||
|
||||
public static SKMaskFilter CreateTable (byte[] table)
|
||||
{
|
||||
if (table == null)
|
||||
|
|
|
@ -237,110 +237,6 @@ namespace SkiaSharp
|
|||
};
|
||||
}
|
||||
|
||||
// Make*
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateIdentity() instead.")]
|
||||
public static SKMatrix MakeIdentity () =>
|
||||
CreateIdentity ();
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateScale(float, float) instead.")]
|
||||
public static SKMatrix MakeScale (float sx, float sy) =>
|
||||
CreateScale (sx, sy);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateScale(float, float, float, float) instead.")]
|
||||
public static SKMatrix MakeScale (float sx, float sy, float pivotX, float pivotY) =>
|
||||
CreateScale (sx, sy, pivotX, pivotY);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateTranslation(float, float) instead.")]
|
||||
public static SKMatrix MakeTranslation (float dx, float dy) =>
|
||||
CreateTranslation (dx, dy);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotation(float) instead.")]
|
||||
public static SKMatrix MakeRotation (float radians) =>
|
||||
CreateRotation (radians);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotation(float, float, float) instead.")]
|
||||
public static SKMatrix MakeRotation (float radians, float pivotx, float pivoty) =>
|
||||
CreateRotation (radians, pivotx, pivoty);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotationDegrees(float) instead.")]
|
||||
public static SKMatrix MakeRotationDegrees (float degrees) =>
|
||||
CreateRotationDegrees (degrees);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotationDegrees(float, float, float) instead.")]
|
||||
public static SKMatrix MakeRotationDegrees (float degrees, float pivotx, float pivoty) =>
|
||||
CreateRotationDegrees (degrees, pivotx, pivoty);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateSkew(float, float) instead.")]
|
||||
public static SKMatrix MakeSkew (float sx, float sy) =>
|
||||
CreateSkew (sx, sy);
|
||||
|
||||
// Set*
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateScaleTranslation(float, float, float, float) instead.")]
|
||||
public void SetScaleTranslate (float sx, float sy, float tx, float ty)
|
||||
{
|
||||
scaleX = sx;
|
||||
skewX = 0;
|
||||
transX = tx;
|
||||
|
||||
skewY = 0;
|
||||
scaleY = sy;
|
||||
transY = ty;
|
||||
|
||||
persp0 = 0;
|
||||
persp1 = 0;
|
||||
persp2 = 1;
|
||||
}
|
||||
|
||||
// Rotate
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotation(float, float, float) instead.")]
|
||||
public static void Rotate (ref SKMatrix matrix, float radians, float pivotx, float pivoty)
|
||||
{
|
||||
var sin = (float)Math.Sin (radians);
|
||||
var cos = (float)Math.Cos (radians);
|
||||
SetSinCos (ref matrix, sin, cos, pivotx, pivoty);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotationDegrees(float, float, float) instead.")]
|
||||
public static void RotateDegrees (ref SKMatrix matrix, float degrees, float pivotx, float pivoty)
|
||||
{
|
||||
var sin = (float)Math.Sin (degrees * DegreesToRadians);
|
||||
var cos = (float)Math.Cos (degrees * DegreesToRadians);
|
||||
SetSinCos (ref matrix, sin, cos, pivotx, pivoty);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotation(float) instead.")]
|
||||
public static void Rotate (ref SKMatrix matrix, float radians)
|
||||
{
|
||||
var sin = (float)Math.Sin (radians);
|
||||
var cos = (float)Math.Cos (radians);
|
||||
SetSinCos (ref matrix, sin, cos);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CreateRotationDegrees(float) instead.")]
|
||||
public static void RotateDegrees (ref SKMatrix matrix, float degrees)
|
||||
{
|
||||
var sin = (float)Math.Sin (degrees * DegreesToRadians);
|
||||
var cos = (float)Math.Cos (degrees * DegreesToRadians);
|
||||
SetSinCos (ref matrix, sin, cos);
|
||||
}
|
||||
|
||||
// Invert
|
||||
|
||||
public readonly bool IsInvertible {
|
||||
|
@ -406,44 +302,6 @@ namespace SkiaSharp
|
|||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use PreConcat(SKMatrix) instead.")]
|
||||
public static void PreConcat (ref SKMatrix target, SKMatrix matrix)
|
||||
{
|
||||
fixed (SKMatrix* t = &target) {
|
||||
SkiaApi.sk_matrix_pre_concat (t, &matrix);
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use PreConcat(SKMatrix) instead.")]
|
||||
public static void PreConcat (ref SKMatrix target, ref SKMatrix matrix)
|
||||
{
|
||||
fixed (SKMatrix* t = &target)
|
||||
fixed (SKMatrix* m = &matrix) {
|
||||
SkiaApi.sk_matrix_pre_concat (t, m);
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use PostConcat(SKMatrix) instead.")]
|
||||
public static void PostConcat (ref SKMatrix target, SKMatrix matrix)
|
||||
{
|
||||
fixed (SKMatrix* t = &target) {
|
||||
SkiaApi.sk_matrix_post_concat (t, &matrix);
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use PostConcat(SKMatrix) instead.")]
|
||||
public static void PostConcat (ref SKMatrix target, ref SKMatrix matrix)
|
||||
{
|
||||
fixed (SKMatrix* t = &target)
|
||||
fixed (SKMatrix* m = &matrix) {
|
||||
SkiaApi.sk_matrix_post_concat (t, m);
|
||||
}
|
||||
}
|
||||
|
||||
// MapRect
|
||||
|
||||
public readonly SKRect MapRect (SKRect source)
|
||||
|
@ -455,17 +313,6 @@ namespace SkiaSharp
|
|||
return dest;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use MapRect(SKRect) instead.")]
|
||||
public static void MapRect (ref SKMatrix matrix, out SKRect dest, ref SKRect source)
|
||||
{
|
||||
fixed (SKMatrix* m = &matrix)
|
||||
fixed (SKRect* d = &dest)
|
||||
fixed (SKRect* s = &source) {
|
||||
SkiaApi.sk_matrix_map_rect (m, d, s);
|
||||
}
|
||||
}
|
||||
|
||||
// MapPoints
|
||||
|
||||
public readonly SKPoint MapPoint (SKPoint point) =>
|
||||
|
|
|
@ -69,13 +69,6 @@ namespace SkiaSharp
|
|||
set => SkiaApi.sk_paint_set_dither (Handle, value);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public bool IsVerticalText {
|
||||
get => false;
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool IsLinearText {
|
||||
get => GetFont ().LinearMetrics;
|
||||
set => GetFont ().LinearMetrics = value;
|
||||
|
@ -114,13 +107,6 @@ namespace SkiaSharp
|
|||
set => GetFont ().Embolden = value;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public bool DeviceKerningEnabled {
|
||||
get => false;
|
||||
set { }
|
||||
}
|
||||
|
||||
public bool IsStroke {
|
||||
get => Style != SKPaintStyle.Fill;
|
||||
set => Style = value ? SKPaintStyle.Stroke : SKPaintStyle.Fill;
|
||||
|
@ -249,11 +235,6 @@ namespace SkiaSharp
|
|||
public float GetFontMetrics (out SKFontMetrics metrics) =>
|
||||
GetFont ().GetFontMetrics (out metrics);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetFontMetrics (out SKFontMetrics) instead.")]
|
||||
public float GetFontMetrics (out SKFontMetrics metrics, float scale) =>
|
||||
GetFontMetrics (out metrics);
|
||||
|
||||
// Clone
|
||||
|
||||
public SKPaint Clone () =>
|
||||
|
|
|
@ -44,11 +44,7 @@ namespace SkiaSharp
|
|||
set => SkiaApi.sk_path_set_filltype (Handle, value);
|
||||
}
|
||||
|
||||
public SKPathConvexity Convexity {
|
||||
get => IsConvex ? SKPathConvexity.Convex : SKPathConvexity.Concave;
|
||||
[Obsolete]
|
||||
set { }
|
||||
}
|
||||
public SKPathConvexity Convexity => IsConvex ? SKPathConvexity.Convex : SKPathConvexity.Concave;
|
||||
|
||||
public bool IsConvex => SkiaApi.sk_path_is_convex (Handle);
|
||||
|
||||
|
@ -375,11 +371,6 @@ namespace SkiaSharp
|
|||
public void AddRoundRect (SKRect rect, float rx, float ry, SKPathDirection dir = SKPathDirection.Clockwise) =>
|
||||
SkiaApi.sk_path_add_rounded_rect (Handle, &rect, rx, ry, dir);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRoundRect instead.")]
|
||||
public void AddRoundedRect (SKRect rect, float rx, float ry, SKPathDirection dir = SKPathDirection.Clockwise) =>
|
||||
AddRoundRect (rect, rx, ry, dir);
|
||||
|
||||
public void AddCircle (float x, float y, float radius, SKPathDirection dir = SKPathDirection.Clockwise) =>
|
||||
SkiaApi.sk_path_add_circle (Handle, x, y, radius, dir);
|
||||
|
||||
|
@ -528,11 +519,6 @@ namespace SkiaSharp
|
|||
protected override void DisposeNative () =>
|
||||
SkiaApi.sk_path_iter_destroy (Handle);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Next(SKPoint[]) instead.")]
|
||||
public SKPathVerb Next (SKPoint[] points, bool doConsumeDegenerates, bool exact) =>
|
||||
Next (points);
|
||||
|
||||
public SKPathVerb Next (SKPoint[] points) =>
|
||||
Next (new Span<SKPoint> (points));
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using SkiaSharp.Internals;
|
||||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public abstract class SKPixelSerializer : SKObject, ISKSkipObjectRegistration
|
||||
{
|
||||
protected SKPixelSerializer ()
|
||||
: base (IntPtr.Zero, false)
|
||||
{
|
||||
}
|
||||
|
||||
public bool UseEncodedData (IntPtr data, ulong length)
|
||||
{
|
||||
if (!PlatformConfiguration.Is64Bit && length > UInt32.MaxValue)
|
||||
throw new ArgumentOutOfRangeException (nameof (length), "The length exceeds the size of pointers.");
|
||||
|
||||
return OnUseEncodedData (data, (IntPtr)length);
|
||||
}
|
||||
|
||||
public SKData Encode (SKPixmap pixmap)
|
||||
{
|
||||
if (pixmap == null)
|
||||
throw new ArgumentNullException (nameof (pixmap));
|
||||
|
||||
return OnEncode (pixmap);
|
||||
}
|
||||
|
||||
protected abstract bool OnUseEncodedData (IntPtr data, IntPtr length);
|
||||
|
||||
protected abstract SKData OnEncode (SKPixmap pixmap);
|
||||
|
||||
public static SKPixelSerializer Create (Func<SKPixmap, SKData> onEncode)
|
||||
{
|
||||
return new SKSimplePixelSerializer (null, onEncode);
|
||||
}
|
||||
|
||||
public static SKPixelSerializer Create (Func<IntPtr, IntPtr, bool> onUseEncodedData, Func<SKPixmap, SKData> onEncode)
|
||||
{
|
||||
return new SKSimplePixelSerializer (onUseEncodedData, onEncode);
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal class SKSimplePixelSerializer : SKPixelSerializer
|
||||
{
|
||||
private readonly Func<IntPtr, IntPtr, bool> onUseEncodedData;
|
||||
private readonly Func<SKPixmap, SKData> onEncode;
|
||||
|
||||
public SKSimplePixelSerializer (Func<IntPtr, IntPtr, bool> onUseEncodedData, Func<SKPixmap, SKData> onEncode)
|
||||
{
|
||||
this.onUseEncodedData = onUseEncodedData;
|
||||
this.onEncode = onEncode;
|
||||
}
|
||||
|
||||
protected override SKData OnEncode (SKPixmap pixmap)
|
||||
{
|
||||
return onEncode?.Invoke (pixmap) ?? null;
|
||||
}
|
||||
|
||||
protected override bool OnUseEncodedData (IntPtr data, IntPtr length)
|
||||
{
|
||||
return onUseEncodedData?.Invoke (data, length) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public abstract class SKManagedPixelSerializer : SKPixelSerializer
|
||||
{
|
||||
public SKManagedPixelSerializer ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,13 +29,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use SKPixmap(SKImageInfo, IntPtr, int) instead.")]
|
||||
public SKPixmap (SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable)
|
||||
: this (info, addr, info.RowBytes)
|
||||
{
|
||||
}
|
||||
|
||||
public SKPixmap (SKImageInfo info, IntPtr addr, int rowBytes)
|
||||
: this (IntPtr.Zero, true)
|
||||
{
|
||||
|
@ -67,13 +60,6 @@ namespace SkiaSharp
|
|||
pixelSource = null;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported. Use Reset(SKImageInfo, IntPtr, int) instead.")]
|
||||
public void Reset (SKImageInfo info, IntPtr addr, int rowBytes, SKColorTable ctable)
|
||||
{
|
||||
Reset (info, addr, rowBytes);
|
||||
}
|
||||
|
||||
public void Reset (SKImageInfo info, IntPtr addr, int rowBytes)
|
||||
{
|
||||
var cinfo = SKImageInfoNative.FromManaged (ref info);
|
||||
|
@ -124,8 +110,8 @@ namespace SkiaSharp
|
|||
public IntPtr GetPixels (int x, int y) =>
|
||||
(IntPtr)SkiaApi.sk_pixmap_get_pixels_with_xy (Handle, x, y);
|
||||
|
||||
public ReadOnlySpan<byte> GetPixelSpan () =>
|
||||
new ReadOnlySpan<byte> (SkiaApi.sk_pixmap_get_pixels (Handle), BytesSize);
|
||||
public Span<byte> GetPixelSpan () =>
|
||||
new Span<byte> (SkiaApi.sk_pixmap_get_pixels (Handle), BytesSize);
|
||||
|
||||
public unsafe Span<T> GetPixelSpan<T> ()
|
||||
where T : unmanaged
|
||||
|
@ -155,26 +141,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_pixmap_get_pixel_color (Handle, x, y);
|
||||
}
|
||||
|
||||
// ColorTable
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("The Index8 color type and color table is no longer supported.")]
|
||||
public SKColorTable ColorTable => null;
|
||||
|
||||
// Resize
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ScalePixels(SKPixmap, SKFilterQuality) instead.")]
|
||||
public static bool Resize (SKPixmap dst, SKPixmap src, SKBitmapResizeMethod method)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.ScalePixels (dst, method.ToFilterQuality ());
|
||||
}
|
||||
|
||||
// ScalePixels
|
||||
|
||||
public bool ScalePixels (SKPixmap destination, SKFilterQuality quality)
|
||||
|
@ -187,11 +153,6 @@ namespace SkiaSharp
|
|||
|
||||
// ReadPixels
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use ReadPixels(SKImageInfo, IntPtr, int, int, int) instead.")]
|
||||
public bool ReadPixels (SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY, SKTransferFunctionBehavior behavior) =>
|
||||
ReadPixels (dstInfo, dstPixels, dstRowBytes, srcX, srcY);
|
||||
|
||||
public bool ReadPixels (SKImageInfo dstInfo, IntPtr dstPixels, int dstRowBytes, int srcX, int srcY)
|
||||
{
|
||||
var cinfo = SKImageInfoNative.FromManaged (ref dstInfo);
|
||||
|
@ -233,30 +194,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_pixmap_encode_image (dst.Handle, Handle, encoder, quality);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Encode(SKWStream, SKEncodedImageFormat, int) instead.")]
|
||||
public static bool Encode (SKWStream dst, SKBitmap src, SKEncodedImageFormat format, int quality)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.Encode (dst, format, quality);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Encode(SKWStream, SKEncodedImageFormat, int) instead.")]
|
||||
public static bool Encode (SKWStream dst, SKPixmap src, SKEncodedImageFormat encoder, int quality)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.Encode (dst, encoder, quality);
|
||||
}
|
||||
|
||||
// Encode (webp)
|
||||
|
||||
public SKData Encode (SKWebpEncoderOptions options)
|
||||
|
@ -283,18 +220,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_webpencoder_encode (dst.Handle, Handle, &options);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Encode(SKWStream, SKWebpEncoderOptions) instead.")]
|
||||
public static bool Encode (SKWStream dst, SKPixmap src, SKWebpEncoderOptions options)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.Encode (dst, options);
|
||||
}
|
||||
|
||||
// Encode (jpeg)
|
||||
|
||||
public SKData Encode (SKJpegEncoderOptions options)
|
||||
|
@ -321,18 +246,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_jpegencoder_encode (dst.Handle, Handle, &options);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Encode(SKWStream, SKJpegEncoderOptions) instead.")]
|
||||
public static bool Encode (SKWStream dst, SKPixmap src, SKJpegEncoderOptions options)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.Encode (dst, options);
|
||||
}
|
||||
|
||||
// Encode (png)
|
||||
|
||||
public SKData Encode (SKPngEncoderOptions options)
|
||||
|
@ -359,18 +272,6 @@ namespace SkiaSharp
|
|||
return SkiaApi.sk_pngencoder_encode (dst.Handle, Handle, &options);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Encode(SKWStream, SKPngEncoderOptions) instead.")]
|
||||
public static bool Encode (SKWStream dst, SKPixmap src, SKPngEncoderOptions options)
|
||||
{
|
||||
if (dst == null)
|
||||
throw new ArgumentNullException (nameof (dst));
|
||||
if (src == null)
|
||||
throw new ArgumentNullException (nameof (src));
|
||||
|
||||
return src.Encode (dst, options);
|
||||
}
|
||||
|
||||
// ExtractSubset
|
||||
|
||||
public SKPixmap ExtractSubset (SKRectI subset)
|
||||
|
|
|
@ -13,46 +13,13 @@ namespace SkiaSharp
|
|||
Size = size;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal SKRunBuffer (SKRunBufferInternal buffer, int size, int textSize)
|
||||
{
|
||||
internalBuffer = buffer;
|
||||
Size = size;
|
||||
TextSize = textSize;
|
||||
}
|
||||
|
||||
public int Size { get; }
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public int TextSize { get; }
|
||||
|
||||
public Span<ushort> GetGlyphSpan () =>
|
||||
new Span<ushort> (internalBuffer.glyphs, internalBuffer.glyphs == null ? 0 : Size);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public Span<byte> GetTextSpan () =>
|
||||
new Span<byte> (internalBuffer.utf8text, internalBuffer.utf8text == null ? 0 : TextSize);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public Span<uint> GetClusterSpan () =>
|
||||
new Span<uint> (internalBuffer.clusters, internalBuffer.clusters == null ? 0 : Size);
|
||||
|
||||
public void SetGlyphs (ReadOnlySpan<ushort> glyphs) =>
|
||||
glyphs.CopyTo (GetGlyphSpan ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public void SetText (ReadOnlySpan<byte> text) =>
|
||||
text.CopyTo (GetTextSpan ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public void SetClusters (ReadOnlySpan<uint> clusters) =>
|
||||
clusters.CopyTo (GetClusterSpan ());
|
||||
}
|
||||
|
||||
public sealed unsafe class SKHorizontalRunBuffer : SKRunBuffer
|
||||
|
@ -62,13 +29,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal SKHorizontalRunBuffer (SKRunBufferInternal buffer, int count, int textSize)
|
||||
: base (buffer, count, textSize)
|
||||
{
|
||||
}
|
||||
|
||||
public Span<float> GetPositionSpan () =>
|
||||
new Span<float> (internalBuffer.pos, internalBuffer.pos == null ? 0 : Size);
|
||||
|
||||
|
@ -83,13 +43,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal SKPositionedRunBuffer (SKRunBufferInternal buffer, int count, int textSize)
|
||||
: base (buffer, count, textSize)
|
||||
{
|
||||
}
|
||||
|
||||
public Span<SKPoint> GetPositionSpan () =>
|
||||
new Span<SKPoint> (internalBuffer.pos, internalBuffer.pos == null ? 0 : Size);
|
||||
|
||||
|
@ -104,13 +57,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
internal SKRotationScaleRunBuffer (SKRunBufferInternal buffer, int count, int textSize)
|
||||
: base (buffer, count, textSize)
|
||||
{
|
||||
}
|
||||
|
||||
public Span<SKRotationScaleMatrix> GetRotationScaleSpan () =>
|
||||
new Span<SKRotationScaleMatrix> (internalBuffer.pos, Size);
|
||||
|
||||
|
|
|
@ -28,17 +28,5 @@ namespace SkiaSharp
|
|||
|
||||
return SKObject.Referenced (SKCanvas.GetObject (SkiaApi.sk_svgcanvas_create_with_stream (&bounds, stream.Handle)), stream);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKRect, Stream) instead.")]
|
||||
public static SKCanvas Create (SKRect bounds, SKXmlWriter writer)
|
||||
{
|
||||
if (writer == null)
|
||||
throw new ArgumentNullException (nameof (writer));
|
||||
|
||||
var canvas = SKCanvas.GetObject (SkiaApi.sk_svgcanvas_create_with_writer (&bounds, writer.Handle));
|
||||
writer.RevokeOwnership (canvas);
|
||||
return SKObject.Referenced (canvas, writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,19 +5,6 @@ namespace SkiaSharp
|
|||
{
|
||||
public unsafe class SKSurface : SKObject, ISKReferenceCounted, ISKSkipObjectRegistration
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo) instead.")]
|
||||
public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType) => Create (new SKImageInfo (width, height, colorType, alphaType));
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, SKSurfaceProps props) => Create (new SKImageInfo (width, height, colorType, alphaType), props);
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo, IntPtr, int) instead.")]
|
||||
public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, IntPtr pixels, int rowBytes) => Create (new SKImageInfo (width, height, colorType, alphaType), pixels, rowBytes);
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo, IntPtr, int, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (int width, int height, SKColorType colorType, SKAlphaType alphaType, IntPtr pixels, int rowBytes, SKSurfaceProps props) => Create (new SKImageInfo (width, height, colorType, alphaType), pixels, rowBytes, props);
|
||||
|
||||
internal SKSurface (IntPtr h, bool owns)
|
||||
: base (h, owns)
|
||||
{
|
||||
|
@ -28,11 +15,6 @@ namespace SkiaSharp
|
|||
|
||||
// RASTER surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (SKImageInfo info, SKSurfaceProps props) =>
|
||||
Create (info, 0, new SKSurfaceProperties (props));
|
||||
|
||||
public static SKSurface Create (SKImageInfo info) =>
|
||||
Create (info, 0, null);
|
||||
|
||||
|
@ -50,11 +32,6 @@ namespace SkiaSharp
|
|||
|
||||
// convenience RASTER DIRECT to use a SKPixmap instead of SKImageInfo and IntPtr
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKPixmap, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (SKPixmap pixmap, SKSurfaceProps props) =>
|
||||
Create (pixmap, new SKSurfaceProperties (props));
|
||||
|
||||
public static SKSurface Create (SKPixmap pixmap) =>
|
||||
Create (pixmap, null);
|
||||
|
||||
|
@ -68,11 +45,6 @@ namespace SkiaSharp
|
|||
|
||||
// RASTER DIRECT surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(SKImageInfo, IntPtr, rowBytes, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (SKImageInfo info, IntPtr pixels, int rowBytes, SKSurfaceProps props) =>
|
||||
Create (info, pixels, rowBytes, null, null, new SKSurfaceProperties (props));
|
||||
|
||||
public static SKSurface Create (SKImageInfo info, IntPtr pixels) =>
|
||||
Create (info, pixels, info.RowBytes, null, null, null);
|
||||
|
||||
|
@ -100,28 +72,6 @@ namespace SkiaSharp
|
|||
|
||||
// GPU BACKEND RENDER TARGET surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendRenderTarget, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRBackendRenderTargetDesc desc)
|
||||
{
|
||||
if (context == null)
|
||||
throw new ArgumentNullException (nameof (context));
|
||||
|
||||
var renderTarget = new GRBackendRenderTarget (context.Backend, desc);
|
||||
return Create (context, renderTarget, desc.Origin, desc.Config.ToColorType (), null, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendRenderTarget, GRSurfaceOrigin, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRBackendRenderTargetDesc desc, SKSurfaceProps props)
|
||||
{
|
||||
if (context == null)
|
||||
throw new ArgumentNullException (nameof (context));
|
||||
|
||||
var renderTarget = new GRBackendRenderTarget (context.Backend, desc);
|
||||
return Create (context, renderTarget, desc.Origin, desc.Config.ToColorType (), null, new SKSurfaceProperties (props));
|
||||
}
|
||||
|
||||
public static SKSurface Create (GRContext context, GRBackendRenderTarget renderTarget, SKColorType colorType) =>
|
||||
Create ((GRRecordingContext)context, renderTarget, colorType);
|
||||
|
||||
|
@ -167,26 +117,6 @@ namespace SkiaSharp
|
|||
|
||||
// GPU BACKEND TEXTURE surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRGlBackendTextureDesc desc) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), null, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRBackendTextureDesc desc) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), null, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRGlBackendTextureDesc desc, SKSurfaceProps props) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), null, new SKSurfaceProperties (props));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (GRContext context, GRBackendTextureDesc desc, SKSurfaceProps props) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), null, new SKSurfaceProperties (props));
|
||||
|
||||
public static SKSurface Create (GRContext context, GRBackendTexture texture, SKColorType colorType) =>
|
||||
Create ((GRRecordingContext)context, texture, colorType);
|
||||
|
||||
|
@ -242,75 +172,8 @@ namespace SkiaSharp
|
|||
return GetObject (SkiaApi.sk_surface_new_backend_texture (context.Handle, texture.Handle, origin, sampleCount, colorType.ToNative (), colorspace?.Handle ?? IntPtr.Zero, props?.Handle ?? IntPtr.Zero));
|
||||
}
|
||||
|
||||
// GPU BACKEND TEXTURE AS RENDER TARGET surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRGlBackendTextureDesc desc) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTextureDesc desc) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRGlBackendTextureDesc desc, SKSurfaceProps props) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), new SKSurfaceProperties (props));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTextureDesc desc, SKSurfaceProps props) =>
|
||||
Create (context, new GRBackendTexture (desc), desc.Origin, desc.SampleCount, desc.Config.ToColorType (), new SKSurfaceProperties (props));
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, SKColorType) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, SKColorType colorType) =>
|
||||
Create (context, texture, colorType);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType) =>
|
||||
Create (context, texture, origin, colorType);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType) =>
|
||||
Create (context, texture, origin, sampleCount, colorType);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKColorSpace) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace) =>
|
||||
Create (context, texture, origin, sampleCount, colorType, colorspace);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, SKColorType colorType, SKSurfaceProperties props) =>
|
||||
Create (context, texture, colorType, props);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget(GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, SKColorType colorType, SKSurfaceProperties props) =>
|
||||
Create (context, texture, origin, colorType, props);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKSurfaceProperties props) =>
|
||||
Create (context, texture, origin, sampleCount, colorType, null, props);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use Create(GRContext, GRBackendTexture, GRSurfaceOrigin, int, SKColorType, SKColorSpace, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface CreateAsRenderTarget (GRContext context, GRBackendTexture texture, GRSurfaceOrigin origin, int sampleCount, SKColorType colorType, SKColorSpace colorspace, SKSurfaceProperties props) =>
|
||||
Create (context, texture, origin, sampleCount, colorType, colorspace, props);
|
||||
|
||||
// GPU NEW surface
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use Create(GRContext, bool, SKImageInfo, int, SKSurfaceProperties) instead.")]
|
||||
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info, int sampleCount, SKSurfaceProps props) =>
|
||||
Create (context, budgeted, info, sampleCount, GRSurfaceOrigin.BottomLeft, new SKSurfaceProperties (props), false);
|
||||
|
||||
public static SKSurface Create (GRContext context, bool budgeted, SKImageInfo info) =>
|
||||
Create ((GRRecordingContext)context, budgeted, info);
|
||||
|
||||
|
@ -399,18 +262,6 @@ namespace SkiaSharp
|
|||
public SKCanvas Canvas =>
|
||||
OwnedBy (SKCanvas.GetObject (SkiaApi.sk_surface_get_canvas (Handle), false, unrefExisting: false), this);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use SurfaceProperties instead.")]
|
||||
public SKSurfaceProps SurfaceProps {
|
||||
get {
|
||||
var props = SurfaceProperties;
|
||||
return new SKSurfaceProps {
|
||||
Flags = props.Flags,
|
||||
PixelGeometry = props.PixelGeometry
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public SKSurfaceProperties SurfaceProperties =>
|
||||
OwnedBy (SKSurfaceProperties.GetObject (SkiaApi.sk_surface_get_props (Handle), false), this);
|
||||
|
||||
|
|
|
@ -10,13 +10,6 @@ namespace SkiaSharp
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public SKSurfaceProperties (SKSurfaceProps props)
|
||||
: this (props.Flags, props.PixelGeometry)
|
||||
{
|
||||
}
|
||||
|
||||
public SKSurfaceProperties (SKPixelGeometry pixelGeometry)
|
||||
: this ((uint)0, pixelGeometry)
|
||||
{
|
||||
|
|
|
@ -448,381 +448,5 @@ namespace SkiaSharp
|
|||
|
||||
return new SKRotationScaleRunBuffer (runbuffer, count);
|
||||
}
|
||||
|
||||
// OBSOLETE OVERLOADS
|
||||
|
||||
// AddRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs, string text, uint[] clusters)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddRun (font, x, y, glyphs, utf8Text, clusters, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs, string text, uint[] clusters, SKRect bounds)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddRun (font, x, y, glyphs, utf8Text, clusters, (SKRect?)bounds);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs) =>
|
||||
AddRun (font, x, y, glyphs, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs, SKRect bounds) =>
|
||||
AddRun (font, x, y, glyphs, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs, byte[] text, uint[] clusters) =>
|
||||
AddRun (font, x, y, glyphs, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ushort[] glyphs, byte[] text, uint[] clusters, SKRect bounds) =>
|
||||
AddRun (font, x, y, glyphs, text, clusters, (SKRect?)bounds);
|
||||
|
||||
// AddRun (spans)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ReadOnlySpan<ushort> glyphs) =>
|
||||
AddRun (font, x, y, glyphs, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ReadOnlySpan<ushort> glyphs, SKRect? bounds) =>
|
||||
AddRun (font, x, y, glyphs, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters) =>
|
||||
AddRun (font, x, y, glyphs, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddRun (ReadOnlySpan<ushort>, SKFont, float, float) instead.")]
|
||||
public void AddRun (SKPaint font, float x, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
if (glyphs.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (glyphs));
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
if (clusters.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (clusters));
|
||||
if (glyphs.Length != clusters.Length)
|
||||
throw new ArgumentException ("The number of glyphs and clusters must be the same.");
|
||||
}
|
||||
|
||||
var run = AllocateRun (font, glyphs.Length, x, y, text.IsEmpty ? 0 : text.Length, bounds);
|
||||
run.SetGlyphs (glyphs);
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
run.SetText (text);
|
||||
run.SetClusters (clusters);
|
||||
}
|
||||
}
|
||||
|
||||
// AddHorizontalRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions, string text, uint[] clusters)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddHorizontalRun (font, y, glyphs, positions, utf8Text, clusters, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions, string text, uint[] clusters, SKRect bounds)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddHorizontalRun (font, y, glyphs, positions, utf8Text, clusters, (SKRect?)bounds);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions, SKRect bounds) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions, byte[] text, uint[] clusters) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ushort[] glyphs, float[] positions, byte[] text, uint[] clusters, SKRect bounds) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, text, clusters, (SKRect?)bounds);
|
||||
|
||||
// AddHorizontalRun (spans)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<float> positions) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<float> positions, SKRect? bounds) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<float> positions, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters) =>
|
||||
AddHorizontalRun (font, y, glyphs, positions, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddHorizontalRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<float>, float) instead.")]
|
||||
public void AddHorizontalRun (SKPaint font, float y, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<float> positions, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
if (glyphs.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (glyphs));
|
||||
if (positions.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (positions));
|
||||
if (glyphs.Length != positions.Length)
|
||||
throw new ArgumentException ("The number of glyphs and positions must be the same.");
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
if (clusters.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (clusters));
|
||||
if (glyphs.Length != clusters.Length)
|
||||
throw new ArgumentException ("The number of glyphs and clusters must be the same.");
|
||||
}
|
||||
|
||||
var run = AllocateHorizontalRun (font, glyphs.Length, y, text.IsEmpty ? 0 : text.Length, bounds);
|
||||
run.SetGlyphs (glyphs);
|
||||
run.SetPositions (positions);
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
run.SetText (text);
|
||||
run.SetClusters (clusters);
|
||||
}
|
||||
}
|
||||
|
||||
// AddPositionedRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions, string text, uint[] clusters)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddPositionedRun (font, glyphs, positions, utf8Text, clusters, null);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions, string text, uint[] clusters, SKRect bounds)
|
||||
{
|
||||
var utf8Text = StringUtilities.GetEncodedText (text, SKTextEncoding.Utf8);
|
||||
AddPositionedRun (font, glyphs, positions, utf8Text, clusters, (SKRect?)bounds);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions) =>
|
||||
AddPositionedRun (font, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions, SKRect bounds) =>
|
||||
AddPositionedRun (font, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions, byte[] text, uint[] clusters) =>
|
||||
AddPositionedRun (font, glyphs, positions, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ushort[] glyphs, SKPoint[] positions, byte[] text, uint[] clusters, SKRect bounds) =>
|
||||
AddPositionedRun (font, glyphs, positions, text, clusters, (SKRect?)bounds);
|
||||
|
||||
// AddPositionedRun (spans)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<SKPoint> positions) =>
|
||||
AddPositionedRun (font, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<SKPoint> positions, SKRect? bounds) =>
|
||||
AddPositionedRun (font, glyphs, positions, ReadOnlySpan<byte>.Empty, ReadOnlySpan<uint>.Empty, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<SKPoint> positions, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters) =>
|
||||
AddPositionedRun (font, glyphs, positions, text, clusters, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AddPositionedRun (ReadOnlySpan<ushort>, SKFont, ReadOnlySpan<SKPoint>) instead.")]
|
||||
public void AddPositionedRun (SKPaint font, ReadOnlySpan<ushort> glyphs, ReadOnlySpan<SKPoint> positions, ReadOnlySpan<byte> text, ReadOnlySpan<uint> clusters, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
if (glyphs.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (glyphs));
|
||||
if (positions.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (positions));
|
||||
if (glyphs.Length != positions.Length)
|
||||
throw new ArgumentException ("The number of glyphs and positions must be the same.");
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
if (clusters.IsEmpty)
|
||||
throw new ArgumentNullException (nameof (clusters));
|
||||
if (glyphs.Length != clusters.Length)
|
||||
throw new ArgumentException ("The number of glyphs and clusters must be the same.");
|
||||
}
|
||||
|
||||
var run = AllocatePositionedRun (font, glyphs.Length, text.IsEmpty ? 0 : text.Length, bounds);
|
||||
run.SetGlyphs (glyphs);
|
||||
run.SetPositions (positions);
|
||||
|
||||
if (!text.IsEmpty) {
|
||||
run.SetText (text);
|
||||
run.SetClusters (clusters);
|
||||
}
|
||||
}
|
||||
|
||||
// AllocateRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateRun (SKFont, int, float, float, SKRect?) instead.")]
|
||||
public SKRunBuffer AllocateRun (SKPaint font, int count, float x, float y) =>
|
||||
AllocateRun (font, count, x, y, 0, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateRun (SKFont, int, float, float, SKRect?) instead.")]
|
||||
public SKRunBuffer AllocateRun (SKPaint font, int count, float x, float y, SKRect? bounds) =>
|
||||
AllocateRun (font, count, x, y, 0, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateRun (SKFont, int, float, float, SKRect?) instead.")]
|
||||
public SKRunBuffer AllocateRun (SKPaint font, int count, float x, float y, int textByteCount) =>
|
||||
AllocateRun (font, count, x, y, textByteCount, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateRun (SKFont, int, float, float, SKRect?) instead.")]
|
||||
public SKRunBuffer AllocateRun (SKPaint font, int count, float x, float y, int textByteCount, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
|
||||
var originalEncoding = font.TextEncoding;
|
||||
try {
|
||||
font.TextEncoding = SKTextEncoding.GlyphId;
|
||||
|
||||
SKRunBufferInternal runbuffer;
|
||||
if (bounds is SKRect b) {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text (Handle, font.GetFont ().Handle, count, x, y, textByteCount, &b, &runbuffer);
|
||||
} else {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text (Handle, font.GetFont ().Handle, count, x, y, textByteCount, null, &runbuffer);
|
||||
}
|
||||
|
||||
return new SKRunBuffer (runbuffer, count, textByteCount);
|
||||
|
||||
} finally {
|
||||
font.TextEncoding = originalEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
// AllocateHorizontalRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateHorizontalRun (SKFont, int, float, SKRect?) instead.")]
|
||||
public SKHorizontalRunBuffer AllocateHorizontalRun (SKPaint font, int count, float y) =>
|
||||
AllocateHorizontalRun (font, count, y, 0, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateHorizontalRun (SKFont, int, float, SKRect?) instead.")]
|
||||
public SKHorizontalRunBuffer AllocateHorizontalRun (SKPaint font, int count, float y, SKRect? bounds) =>
|
||||
AllocateHorizontalRun (font, count, y, 0, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateHorizontalRun (SKFont, int, float, SKRect?) instead.")]
|
||||
public SKHorizontalRunBuffer AllocateHorizontalRun (SKPaint font, int count, float y, int textByteCount) =>
|
||||
AllocateHorizontalRun (font, count, y, textByteCount, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocateHorizontalRun (SKFont, int, float, SKRect?) instead.")]
|
||||
public SKHorizontalRunBuffer AllocateHorizontalRun (SKPaint font, int count, float y, int textByteCount, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
|
||||
var originalEncoding = font.TextEncoding;
|
||||
try {
|
||||
font.TextEncoding = SKTextEncoding.GlyphId;
|
||||
|
||||
SKRunBufferInternal runbuffer;
|
||||
if (bounds is SKRect b) {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text_pos_h (Handle, font.GetFont ().Handle, count, y, textByteCount, &b, &runbuffer);
|
||||
} else {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text_pos_h (Handle, font.GetFont ().Handle, count, y, textByteCount, null, &runbuffer);
|
||||
}
|
||||
|
||||
return new SKHorizontalRunBuffer (runbuffer, count, textByteCount);
|
||||
} finally {
|
||||
font.TextEncoding = originalEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
// AllocatePositionedRun
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocatePositionedRun (SKFont, int, SKRect?) instead.")]
|
||||
public SKPositionedRunBuffer AllocatePositionedRun (SKPaint font, int count) =>
|
||||
AllocatePositionedRun (font, count, 0, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocatePositionedRun (SKFont, int, SKRect?) instead.")]
|
||||
public SKPositionedRunBuffer AllocatePositionedRun (SKPaint font, int count, SKRect? bounds) =>
|
||||
AllocatePositionedRun (font, count, 0, bounds);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocatePositionedRun (SKFont, int, SKRect?) instead.")]
|
||||
public SKPositionedRunBuffer AllocatePositionedRun (SKPaint font, int count, int textByteCount) =>
|
||||
AllocatePositionedRun (font, count, textByteCount, null);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use AllocatePositionedRun (SKFont, int, SKRect?) instead.")]
|
||||
public SKPositionedRunBuffer AllocatePositionedRun (SKPaint font, int count, int textByteCount, SKRect? bounds)
|
||||
{
|
||||
if (font == null)
|
||||
throw new ArgumentNullException (nameof (font));
|
||||
|
||||
var originalEncoding = font.TextEncoding;
|
||||
try {
|
||||
font.TextEncoding = SKTextEncoding.GlyphId;
|
||||
|
||||
SKRunBufferInternal runbuffer;
|
||||
if (bounds is SKRect b) {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text_pos (Handle, font.GetFont ().Handle, count, textByteCount, &b, &runbuffer);
|
||||
} else {
|
||||
SkiaApi.sk_textblob_builder_alloc_run_text_pos (Handle, font.GetFont ().Handle, count, textByteCount, null, &runbuffer);
|
||||
}
|
||||
|
||||
return new SKPositionedRunBuffer (runbuffer, count, textByteCount);
|
||||
} finally {
|
||||
font.TextEncoding = originalEncoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,17 +4,6 @@ using System.IO;
|
|||
|
||||
namespace SkiaSharp
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Flags]
|
||||
[Obsolete ("Use SKFontStyleWeight and SKFontStyleSlant instead.")]
|
||||
public enum SKTypefaceStyle
|
||||
{
|
||||
Normal = 0,
|
||||
Bold = 0x01,
|
||||
Italic = 0x02,
|
||||
BoldItalic = 0x03
|
||||
}
|
||||
|
||||
public unsafe class SKTypeface : SKObject, ISKReferenceCounted
|
||||
{
|
||||
private static readonly SKTypeface defaultTypeface;
|
||||
|
@ -51,16 +40,6 @@ namespace SkiaSharp
|
|||
|
||||
// FromFamilyName
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FromFamilyName(string, SKFontStyleWeight, SKFontStyleWidth, SKFontStyleSlant) instead.")]
|
||||
public static SKTypeface FromFamilyName (string familyName, SKTypefaceStyle style)
|
||||
{
|
||||
var weight = style.HasFlag (SKTypefaceStyle.Bold) ? SKFontStyleWeight.Bold : SKFontStyleWeight.Normal;
|
||||
var slant = style.HasFlag (SKTypefaceStyle.Italic) ? SKFontStyleSlant.Italic : SKFontStyleSlant.Upright;
|
||||
|
||||
return FromFamilyName (familyName, weight, SKFontStyleWidth.Normal, slant);
|
||||
}
|
||||
|
||||
public static SKTypeface FromFamilyName (string familyName, int weight, int width, SKFontStyleSlant slant)
|
||||
{
|
||||
return FromFamilyName (familyName, new SKFontStyle (weight, width, slant));
|
||||
|
@ -92,20 +71,6 @@ namespace SkiaSharp
|
|||
|
||||
// From*
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
public static SKTypeface FromTypeface (SKTypeface typeface, SKTypefaceStyle style)
|
||||
{
|
||||
if (typeface == null)
|
||||
throw new ArgumentNullException (nameof (typeface));
|
||||
|
||||
var weight = style.HasFlag (SKTypefaceStyle.Bold) ? SKFontStyleWeight.Bold : SKFontStyleWeight.Normal;
|
||||
var width = SKFontStyleWidth.Normal;
|
||||
var slant = style.HasFlag (SKTypefaceStyle.Italic) ? SKFontStyleSlant.Italic : SKFontStyleSlant.Upright;
|
||||
|
||||
return SKFontManager.Default.MatchTypeface (typeface, new SKFontStyle (weight, width, slant));
|
||||
}
|
||||
|
||||
public static SKTypeface FromFile (string path, int index = 0)
|
||||
{
|
||||
if (path == null)
|
||||
|
@ -148,18 +113,6 @@ namespace SkiaSharp
|
|||
return GetObject (SkiaApi.sk_typeface_create_from_data (data.Handle, index));
|
||||
}
|
||||
|
||||
// CharsToGlyphs
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(string, out ushort[]) instead.")]
|
||||
public int CharsToGlyphs (string chars, out ushort[] glyphs) =>
|
||||
GetGlyphs (chars, out glyphs);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(IntPtr, int, SKTextEncoding, out ushort[]) instead.")]
|
||||
public int CharsToGlyphs (IntPtr str, int strlen, SKEncoding encoding, out ushort[] glyphs) =>
|
||||
GetGlyphs (str, strlen, encoding, out glyphs);
|
||||
|
||||
// Properties
|
||||
|
||||
public string FamilyName => (string)SKString.GetObject (SkiaApi.sk_typeface_get_family_name (Handle));
|
||||
|
@ -178,19 +131,6 @@ namespace SkiaSharp
|
|||
|
||||
public bool IsFixedPitch => SkiaApi.sk_typeface_is_fixed_pitch (Handle);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use FontWeight and FontSlant instead.")]
|
||||
public SKTypefaceStyle Style {
|
||||
get {
|
||||
var style = SKTypefaceStyle.Normal;
|
||||
if (FontWeight >= (int)SKFontStyleWeight.SemiBold)
|
||||
style |= SKTypefaceStyle.Bold;
|
||||
if (FontSlant != (int)SKFontStyleSlant.Upright)
|
||||
style |= SKTypefaceStyle.Italic;
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
public int UnitsPerEm => SkiaApi.sk_typeface_get_units_per_em (Handle);
|
||||
|
||||
public int GlyphCount => SkiaApi.sk_typeface_count_glyphs (Handle);
|
||||
|
@ -255,138 +195,48 @@ namespace SkiaSharp
|
|||
return actual != IntPtr.Zero;
|
||||
}
|
||||
|
||||
// CountGlyphs (string/char)
|
||||
// CountGlyphs
|
||||
|
||||
public int CountGlyphs (string str) =>
|
||||
GetFont ().CountGlyphs (str);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CountGlyphs(string) instead.")]
|
||||
public int CountGlyphs (string str, SKEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str);
|
||||
|
||||
public int CountGlyphs (ReadOnlySpan<char> str) =>
|
||||
GetFont ().CountGlyphs (str);
|
||||
|
||||
// CountGlyphs (byte[])
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CountGlyphs(byte[], SKTextEncoding) instead.")]
|
||||
public int CountGlyphs (byte[] str, SKEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str, encoding.ToTextEncoding ());
|
||||
|
||||
public int CountGlyphs (byte[] str, SKTextEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str, encoding);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CountGlyphs(ReadOnlySpan<byte>, SKTextEncoding) instead.")]
|
||||
public int CountGlyphs (ReadOnlySpan<byte> str, SKEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str, encoding.ToTextEncoding ());
|
||||
|
||||
public int CountGlyphs (ReadOnlySpan<byte> str, SKTextEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str, encoding);
|
||||
|
||||
// CountGlyphs (IntPtr)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use CountGlyphs(IntPtr, int, SKTextEncoding) instead.")]
|
||||
public int CountGlyphs (IntPtr str, int strLen, SKEncoding encoding) =>
|
||||
CountGlyphs (str, strLen, encoding.ToTextEncoding ());
|
||||
|
||||
public int CountGlyphs (IntPtr str, int strLen, SKTextEncoding encoding) =>
|
||||
GetFont ().CountGlyphs (str, strLen * encoding.GetCharacterByteSize (), encoding);
|
||||
|
||||
// GetGlyph (int)
|
||||
// GetGlyph
|
||||
|
||||
public ushort GetGlyph (int codepoint) =>
|
||||
GetFont ().GetGlyph (codepoint);
|
||||
|
||||
// GetGlyphs (int)
|
||||
// GetGlyphs
|
||||
|
||||
public ushort[] GetGlyphs (ReadOnlySpan<int> codepoints) =>
|
||||
GetFont ().GetGlyphs (codepoints);
|
||||
|
||||
// GetGlyphs (string/char, out)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(string) instead.")]
|
||||
public int GetGlyphs (string text, out ushort[] glyphs)
|
||||
{
|
||||
glyphs = GetGlyphs (text);
|
||||
return glyphs.Length;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(string) instead.")]
|
||||
public int GetGlyphs (string text, SKEncoding encoding, out ushort[] glyphs) =>
|
||||
GetGlyphs (text, out glyphs);
|
||||
|
||||
// GetGlyphs (byte[], out)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(byte[], SKTextEncoding) instead.")]
|
||||
public int GetGlyphs (byte[] text, SKEncoding encoding, out ushort[] glyphs) =>
|
||||
GetGlyphs (text.AsSpan (), encoding, out glyphs);
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(ReadOnlySpan<byte>, SKTextEncoding) instead.")]
|
||||
public int GetGlyphs (ReadOnlySpan<byte> text, SKEncoding encoding, out ushort[] glyphs)
|
||||
{
|
||||
glyphs = GetGlyphs (text, encoding);
|
||||
return glyphs.Length;
|
||||
}
|
||||
|
||||
// GetGlyphs (IntPtr, out)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(IntPtr, int, SKTextEncoding) instead.")]
|
||||
public int GetGlyphs (IntPtr text, int length, SKEncoding encoding, out ushort[] glyphs)
|
||||
{
|
||||
glyphs = GetGlyphs (text, length, encoding);
|
||||
return glyphs.Length;
|
||||
}
|
||||
|
||||
// GetGlyphs (string/char)
|
||||
|
||||
public ushort[] GetGlyphs (string text) =>
|
||||
GetGlyphs (text.AsSpan ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(string) instead.")]
|
||||
public ushort[] GetGlyphs (string text, SKEncoding encoding) =>
|
||||
GetGlyphs (text.AsSpan ());
|
||||
|
||||
public ushort[] GetGlyphs (ReadOnlySpan<char> text)
|
||||
{
|
||||
using var font = ToFont ();
|
||||
return font.GetGlyphs (text);
|
||||
}
|
||||
|
||||
// GetGlyphs (byte[])
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(ReadOnlySpan<byte>, SKTextEncoding) instead.")]
|
||||
public ushort[] GetGlyphs (byte[] text, SKEncoding encoding) =>
|
||||
GetGlyphs (text.AsSpan (), encoding.ToTextEncoding ());
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(ReadOnlySpan<byte>, SKTextEncoding) instead.")]
|
||||
public ushort[] GetGlyphs (ReadOnlySpan<byte> text, SKEncoding encoding) =>
|
||||
GetGlyphs (text, encoding.ToTextEncoding ());
|
||||
|
||||
public ushort[] GetGlyphs (ReadOnlySpan<byte> text, SKTextEncoding encoding)
|
||||
{
|
||||
using var font = ToFont ();
|
||||
return font.GetGlyphs (text, encoding);
|
||||
}
|
||||
|
||||
// GetGlyphs (IntPtr)
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetGlyphs(IntPtr, int, SKTextEncoding) instead.")]
|
||||
public ushort[] GetGlyphs (IntPtr text, int length, SKEncoding encoding) =>
|
||||
GetGlyphs (text, length, encoding.ToTextEncoding ());
|
||||
|
||||
public ushort[] GetGlyphs (IntPtr text, int length, SKTextEncoding encoding)
|
||||
{
|
||||
using var font = ToFont ();
|
||||
|
|
|
@ -156,11 +156,6 @@ namespace SkiaSharp
|
|||
|
||||
// GetEncodedText
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete ("Use GetEncodedText(string, SKTextEncoding) instead.")]
|
||||
public static byte[] GetEncodedText (string text, SKEncoding encoding) =>
|
||||
GetEncodedText (text.AsSpan (), encoding.ToTextEncoding ());
|
||||
|
||||
public static byte[] GetEncodedText (string text, SKTextEncoding encoding) =>
|
||||
GetEncodedText (text.AsSpan (), encoding);
|
||||
|
||||
|
|
|
@ -110,7 +110,6 @@ var TRACKED_NUGETS = new Dictionary<string, Version> {
|
|||
{ "SkiaSharp.Views.WinUI", new Version (1, 60, 0) },
|
||||
{ "SkiaSharp.Views.Maui.Core", new Version (1, 60, 0) },
|
||||
{ "SkiaSharp.Views.Maui.Controls", new Version (1, 60, 0) },
|
||||
{ "SkiaSharp.Views.Maui.Controls.Compatibility", new Version (1, 60, 0) },
|
||||
{ "SkiaSharp.Views.Blazor", new Version (1, 60, 0) },
|
||||
{ "HarfBuzzSharp", new Version (1, 0, 0) },
|
||||
{ "HarfBuzzSharp.NativeAssets.Android", new Version (1, 0, 0) },
|
||||
|
|
|
@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\..\bindi
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj", "{0D807035-36EE-4A73-A8A8-8590A45BCECE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls.Compatibility", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj", "{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Core", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Core\SkiaSharp.Views.Maui.Core.csproj", "{77254DC0-975A-443D-8E33-54D3E8F64647}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views", "..\..\..\source\SkiaSharp.Views\SkiaSharp.Views\SkiaSharp.Views.csproj", "{CEEC7394-34BC-421D-B54B-5480B120D56E}"
|
||||
|
@ -35,10 +33,6 @@ Global
|
|||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"path": "SkiaSharpSample.sln",
|
||||
"projects": [
|
||||
"..\\..\\..\\binding\\SkiaSharp\\SkiaSharp.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls.Compatibility\\SkiaSharp.Views.Maui.Controls.Compatibility.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls\\SkiaSharp.Views.Maui.Controls.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Core\\SkiaSharp.Views.Maui.Core.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views\\SkiaSharp.Views\\SkiaSharp.Views.csproj",
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"path": "SkiaSharpSample.sln",
|
||||
"projects": [
|
||||
"..\\..\\..\\binding\\SkiaSharp\\SkiaSharp.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls.Compatibility\\SkiaSharp.Views.Maui.Controls.Compatibility.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls\\SkiaSharp.Views.Maui.Controls.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Core\\SkiaSharp.Views.Maui.Core.csproj",
|
||||
"..\\..\\..\\source\\SkiaSharp.Views\\SkiaSharp.Views\\SkiaSharp.Views.csproj",
|
||||
|
|
|
@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\..\bindi
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj", "{0D807035-36EE-4A73-A8A8-8590A45BCECE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls.Compatibility", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj", "{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Core", "..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Core\SkiaSharp.Views.Maui.Core.csproj", "{77254DC0-975A-443D-8E33-54D3E8F64647}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views", "..\..\..\source\SkiaSharp.Views\SkiaSharp.Views\SkiaSharp.Views.csproj", "{CEEC7394-34BC-421D-B54B-5480B120D56E}"
|
||||
|
@ -37,10 +35,6 @@ Global
|
|||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0D807035-36EE-4A73-A8A8-8590A45BCECE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1816FAA6-5682-4155-AC2D-517D6C5FE2DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77254DC0-975A-443D-8E33-54D3E8F64647}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace SkiaSharpSample
|
|||
public static MauiApp CreateMauiApp() =>
|
||||
MauiApp
|
||||
.CreateBuilder()
|
||||
.UseSkiaSharp(true)
|
||||
.UseMauiApp<App>()
|
||||
.UseSkiaSharp()
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ SkiaSharp.Views.Uno.WinUI nuget 3.0.0
|
|||
SkiaSharp.Views.WinUI nuget 3.0.0
|
||||
SkiaSharp.Views.Maui.Core nuget 3.0.0
|
||||
SkiaSharp.Views.Maui.Controls nuget 3.0.0
|
||||
SkiaSharp.Views.Maui.Controls.Compatibility nuget 3.0.0
|
||||
SkiaSharp.Views.Blazor nuget 3.0.0
|
||||
SkiaSharp.HarfBuzz nuget 3.0.0
|
||||
SkiaSharp.Skottie nuget 3.0.0
|
||||
|
|
|
@ -145,14 +145,14 @@ internal partial class VersionConstants {
|
|||
Sign the assembly using sn.
|
||||
===================================================================================================================
|
||||
-->
|
||||
<PropertyGroup Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(TargetPath)' != '' ">
|
||||
<PropertyGroup Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(TargetPath)' != '' and '$(BuildingInsideVisualStudio)' != 'true'">
|
||||
<_SignAssemblyAfterTargets>
|
||||
CoreCompile
|
||||
</_SignAssemblyAfterTargets>
|
||||
</PropertyGroup>
|
||||
<Target Name="_SignAssembly"
|
||||
AfterTargets="$(_SignAssemblyAfterTargets)"
|
||||
Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(TargetPath)' != '' ">
|
||||
Condition=" $(IsWindows) and '$(SignAssembly)' == 'true' and '$(TargetPath)' != '' and '$(BuildingInsideVisualStudio)' != 'true' ">
|
||||
<Exec Command=""$(_SnExePath)" -q -R @(IntermediateAssembly -> '"%(Identity)"') "$(AssemblyOriginatorKeyFile)"" />
|
||||
</Target>
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.Maui.Controls.Compatibility.Hosting;
|
||||
using Microsoft.Maui.Hosting;
|
||||
using SkiaSharp.Views.Maui.Controls.Compatibility;
|
||||
using SkiaSharp.Views.Maui.Controls.Hosting;
|
||||
using CompatRegistrar = Microsoft.Maui.Controls.Internals.Registrar;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("Use SkiaSharp.Views.Maui.Controls.Hosting instead.", true)]
|
||||
public static class AppHostBuilderExtensions
|
||||
{
|
||||
[Obsolete("Use SkiaSharp.Views.Maui.Controls.Hosting.UseSkiaSharp(bool, bool) instead.", true)]
|
||||
public static MauiAppBuilder UseSkiaSharpCompatibilityRenderers(this MauiAppBuilder builder) => builder.UseSkiaSharp(true);
|
||||
}
|
||||
}
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Hosting
|
||||
{
|
||||
public static class AppHostBuilderExtensions
|
||||
{
|
||||
public static MauiAppBuilder UseSkiaSharp(this MauiAppBuilder builder, bool registerRenderers, bool replaceHandlers = false) =>
|
||||
builder
|
||||
.UseSkiaSharp()
|
||||
.ConfigureMauiHandlers(handlers =>
|
||||
{
|
||||
#if !NETSTANDARD
|
||||
if (registerRenderers)
|
||||
{
|
||||
#if !__TIZEN__
|
||||
if (replaceHandlers)
|
||||
handlers.AddHandler<SKCanvasView, SKCanvasViewRenderer>();
|
||||
else
|
||||
handlers.TryAddHandler<SKCanvasView, SKCanvasViewRenderer>();
|
||||
|
||||
#if !WINDOWS && !__MACCATALYST__
|
||||
if (replaceHandlers)
|
||||
handlers.AddHandler<SKGLView, SKGLViewRenderer>();
|
||||
else
|
||||
handlers.TryAddHandler<SKGLView, SKGLViewRenderer>();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !__TIZEN__
|
||||
CompatRegistrar.Registered.Register(typeof(SKImageImageSource), typeof(SKImageSourceHandler));
|
||||
CompatRegistrar.Registered.Register(typeof(SKBitmapImageSource), typeof(SKImageSourceHandler));
|
||||
CompatRegistrar.Registered.Register(typeof(SKPixmapImageSource), typeof(SKImageSourceHandler));
|
||||
CompatRegistrar.Registered.Register(typeof(SKPictureImageSource), typeof(SKImageSourceHandler));
|
||||
#endif
|
||||
#endif
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.Android;
|
||||
using SkiaSharp.Views.Android;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
public sealed class SKImageSourceHandler : IImageSourceHandler
|
||||
{
|
||||
public Task<Bitmap> LoadImageAsync(ImageSource imagesource, Context context, CancellationToken cancelationToken = default(CancellationToken))
|
||||
{
|
||||
Bitmap bitmap = null;
|
||||
|
||||
var imageImageSource = imagesource as SKImageImageSource;
|
||||
if (imageImageSource != null)
|
||||
{
|
||||
bitmap = imageImageSource.Image?.ToBitmap();
|
||||
}
|
||||
|
||||
var bitmapImageSource = imagesource as SKBitmapImageSource;
|
||||
if (bitmapImageSource != null)
|
||||
{
|
||||
bitmap = bitmapImageSource.Bitmap?.ToBitmap();
|
||||
}
|
||||
|
||||
var pixmapImageSource = imagesource as SKPixmapImageSource;
|
||||
if (pixmapImageSource != null)
|
||||
{
|
||||
bitmap = pixmapImageSource.Pixmap?.ToBitmap();
|
||||
}
|
||||
|
||||
var pictureImageSource = imagesource as SKPictureImageSource;
|
||||
if (pictureImageSource != null)
|
||||
{
|
||||
bitmap = pictureImageSource.Picture?.ToBitmap(pictureImageSource.Dimensions);
|
||||
}
|
||||
|
||||
return Task.FromResult(bitmap);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
|
||||
using Tizen.NUI.BaseComponents;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
public sealed class SKImageSourceHandler : IImageSourceHandler
|
||||
{
|
||||
private StreamImageSourceHandler handler = new StreamImageSourceHandler();
|
||||
|
||||
public Task<bool> LoadImageAsync(ImageView image, ImageSource imageSource, CancellationToken cancelationToken = default(CancellationToken))
|
||||
{
|
||||
ImageSource newSource = null;
|
||||
|
||||
switch (imageSource)
|
||||
{
|
||||
case SKImageImageSource imageImageSource:
|
||||
newSource = ImageSource.FromStream(() => ToStream(imageImageSource.Image));
|
||||
break;
|
||||
case SKBitmapImageSource bitmapImageSource:
|
||||
newSource = ImageSource.FromStream(() => ToStream(SKImage.FromBitmap(bitmapImageSource.Bitmap)));
|
||||
break;
|
||||
case SKPixmapImageSource pixmapImageSource:
|
||||
newSource = ImageSource.FromStream(() => ToStream(SKImage.FromPixels(pixmapImageSource.Pixmap)));
|
||||
break;
|
||||
case SKPictureImageSource pictureImageSource:
|
||||
newSource = ImageSource.FromStream(() => ToStream(SKImage.FromPicture(pictureImageSource.Picture, pictureImageSource.Dimensions)));
|
||||
break;
|
||||
}
|
||||
|
||||
return handler.LoadImageAsync(image, newSource, cancelationToken);
|
||||
}
|
||||
|
||||
private static Stream ToStream(SKImage skiaImage)
|
||||
{
|
||||
return skiaImage.Encode().AsStream();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
using SkiaSharp.Views.Windows;
|
||||
|
||||
using WImageSource = Microsoft.UI.Xaml.Media.ImageSource;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
public sealed class SKImageSourceHandler : IImageSourceHandler
|
||||
{
|
||||
public Task<WImageSource> LoadImageAsync(ImageSource imagesource, CancellationToken cancelationToken = default(CancellationToken))
|
||||
{
|
||||
WImageSource image = null;
|
||||
|
||||
var imageImageSource = imagesource as SKImageImageSource;
|
||||
if (imageImageSource != null)
|
||||
{
|
||||
image = imageImageSource.Image?.ToWriteableBitmap();
|
||||
}
|
||||
|
||||
var bitmapImageSource = imagesource as SKBitmapImageSource;
|
||||
if (bitmapImageSource != null)
|
||||
{
|
||||
image = bitmapImageSource.Bitmap?.ToWriteableBitmap();
|
||||
}
|
||||
|
||||
var pixmapImageSource = imagesource as SKPixmapImageSource;
|
||||
if (pixmapImageSource != null)
|
||||
{
|
||||
image = pixmapImageSource.Pixmap?.ToWriteableBitmap();
|
||||
}
|
||||
|
||||
var pictureImageSource = imagesource as SKPictureImageSource;
|
||||
if (pictureImageSource != null)
|
||||
{
|
||||
image = pictureImageSource.Picture?.ToWriteableBitmap(pictureImageSource.Dimensions);
|
||||
}
|
||||
|
||||
return Task.FromResult(image);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
|
||||
using SkiaSharp.Views.iOS;
|
||||
using UIKit;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
public sealed class SKImageSourceHandler : IImageSourceHandler
|
||||
{
|
||||
public Task<UIImage> LoadImageAsync(ImageSource imagesource, CancellationToken cancelationToken = default(CancellationToken), float scale = 1f)
|
||||
{
|
||||
UIImage image = null;
|
||||
|
||||
var imageImageSource = imagesource as SKImageImageSource;
|
||||
if (imageImageSource != null)
|
||||
{
|
||||
image = imageImageSource.Image?.ToUIImage();
|
||||
}
|
||||
|
||||
var bitmapImageSource = imagesource as SKBitmapImageSource;
|
||||
if (bitmapImageSource != null)
|
||||
{
|
||||
image = bitmapImageSource.Bitmap?.ToUIImage();
|
||||
}
|
||||
|
||||
var pixmapImageSource = imagesource as SKPixmapImageSource;
|
||||
if (pixmapImageSource != null)
|
||||
{
|
||||
image = pixmapImageSource.Pixmap?.ToUIImage();
|
||||
}
|
||||
|
||||
var pictureImageSource = imagesource as SKPictureImageSource;
|
||||
if (pictureImageSource != null)
|
||||
{
|
||||
image = pictureImageSource.Picture?.ToUIImage(pictureImageSource.Dimensions);
|
||||
}
|
||||
|
||||
return Task.FromResult(image);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using Android.Content;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.Android.SKCanvasView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKCanvasViewRenderer : SKCanvasViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
public SKCanvasViewRenderer(Context context)
|
||||
: base(context)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SKNativeView CreateNativeControl() =>
|
||||
GetType() == typeof(SKCanvasViewRenderer)
|
||||
? new SKNativeView(Context)
|
||||
: base.CreateNativeControl();
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
internal class SKCanvasViewRenderer
|
||||
{
|
||||
public SKCanvasViewRenderer()
|
||||
{
|
||||
throw new PlatformNotSupportedException("SKCanvasView is not yet supported on this platform.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.Tizen.NUI.SKCanvasView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKCanvasViewRenderer : SKCanvasViewRendererBase<SKFormsView, SKNativeView>, IRegisterable
|
||||
{
|
||||
protected override SKNativeView CreateNativeControl() =>
|
||||
GetType() == typeof(SKCanvasViewRenderer)
|
||||
? new SKNativeView()
|
||||
: base.CreateNativeControl();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.Windows.SKXamlCanvas;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKCanvasViewRenderer : SKCanvasViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override SKNativeView CreateNativeControl() =>
|
||||
GetType() == typeof(SKCanvasViewRenderer)
|
||||
? new SKNativeView()
|
||||
: base.CreateNativeControl();
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
|
||||
using SKNativeView = SkiaSharp.Views.iOS.SKCanvasView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKCanvasViewRenderer : SKCanvasViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
public SKCanvasViewRenderer()
|
||||
{
|
||||
SetDisablesUserInteraction(true);
|
||||
}
|
||||
|
||||
protected override SKNativeView CreateNativeControl()
|
||||
{
|
||||
var view = GetType() == typeof(SKCanvasViewRenderer)
|
||||
? new SKNativeView()
|
||||
: base.CreateNativeControl();
|
||||
|
||||
// Force the opacity to false for consistency with the other platforms
|
||||
view.Opaque = false;
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,237 +0,0 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
using Microsoft.Maui.Platform;
|
||||
using SkiaSharp.Views.Maui.Platform;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
|
||||
|
||||
#if __ANDROID__
|
||||
using Android.Content;
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using SKNativeView = SkiaSharp.Views.Android.SKCanvasView;
|
||||
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Android.SKPaintSurfaceEventArgs;
|
||||
#elif __IOS__
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using SKNativeView = SkiaSharp.Views.iOS.SKCanvasView;
|
||||
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.iOS.SKPaintSurfaceEventArgs;
|
||||
#elif WINDOWS
|
||||
using Windows.Graphics.Display;
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using SKNativeView = SkiaSharp.Views.Windows.SKXamlCanvas;
|
||||
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Windows.SKPaintSurfaceEventArgs;
|
||||
using WVisibility = Microsoft.UI.Xaml.Visibility;
|
||||
#elif __TIZEN__
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
|
||||
using SKNativeView = SkiaSharp.Views.Tizen.NUI.SKCanvasView;
|
||||
using SKNativePaintSurfaceEventArgs = SkiaSharp.Views.Tizen.SKPaintSurfaceEventArgs;
|
||||
#endif
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public abstract class SKCanvasViewRendererBase<TFormsView, TNativeView> : ViewRenderer<TFormsView, TNativeView>
|
||||
where TFormsView : SKFormsView
|
||||
where TNativeView : SKNativeView
|
||||
{
|
||||
private SKTouchHandler touchHandler;
|
||||
|
||||
#if __ANDROID__
|
||||
protected SKCanvasViewRendererBase(Context context)
|
||||
: base(context)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
#else
|
||||
protected SKCanvasViewRendererBase()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
touchHandler = new SKTouchHandler(
|
||||
args => ((ISKCanvasViewController)Element).OnTouch(args),
|
||||
(x, y) => GetScaledCoord(x, y));
|
||||
}
|
||||
|
||||
#if __IOS__
|
||||
protected void SetDisablesUserInteraction(bool disablesUserInteraction)
|
||||
{
|
||||
touchHandler.DisablesUserInteraction = disablesUserInteraction;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<TFormsView> e)
|
||||
{
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
var oldController = (ISKCanvasViewController)e.OldElement;
|
||||
|
||||
// unsubscribe from events
|
||||
oldController.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
oldController.GetCanvasSize -= OnGetCanvasSize;
|
||||
}
|
||||
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
var newController = (ISKCanvasViewController)e.NewElement;
|
||||
|
||||
// create the native view
|
||||
if (Control == null)
|
||||
{
|
||||
var view = CreateNativeControl();
|
||||
view.PaintSurface += OnPaintSurface;
|
||||
SetNativeControl(view);
|
||||
}
|
||||
|
||||
// set the initial values
|
||||
touchHandler.SetEnabled(Control, e.NewElement.EnableTouchEvents);
|
||||
|
||||
// TODO: implement this if it is actually supported
|
||||
Control.IgnorePixelScaling = e.NewElement.IgnorePixelScaling;
|
||||
|
||||
// subscribe to events from the user
|
||||
newController.SurfaceInvalidated += OnSurfaceInvalidated;
|
||||
newController.GetCanvasSize += OnGetCanvasSize;
|
||||
|
||||
// paint for the first time
|
||||
OnSurfaceInvalidated(newController, EventArgs.Empty);
|
||||
}
|
||||
|
||||
base.OnElementChanged(e);
|
||||
}
|
||||
|
||||
#if __ANDROID__
|
||||
protected override TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView), new[] { Context });
|
||||
}
|
||||
#elif __TIZEN__
|
||||
protected virtual TNativeView CreateNativeControl()
|
||||
{
|
||||
TNativeView ret = (TNativeView)Activator.CreateInstance(typeof(TNativeView));
|
||||
return ret;
|
||||
}
|
||||
#elif __IOS__
|
||||
protected override TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView));
|
||||
}
|
||||
#else
|
||||
protected virtual TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView));
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
|
||||
if (e.PropertyName == SKFormsView.IgnorePixelScalingProperty.PropertyName)
|
||||
{
|
||||
// TODO: implement this if it is actually supported
|
||||
Control.IgnorePixelScaling = Element.IgnorePixelScaling;
|
||||
}
|
||||
else if (e.PropertyName == SKFormsView.EnableTouchEventsProperty.PropertyName)
|
||||
{
|
||||
touchHandler.SetEnabled(Control, Element.EnableTouchEvents);
|
||||
}
|
||||
#if WINDOWS
|
||||
else if (e.PropertyName == VisualElement.IsVisibleProperty.PropertyName)
|
||||
{
|
||||
// pass the visibility down to the view do disable drawing
|
||||
Control.Visibility = Element.IsVisible
|
||||
? WVisibility.Visible
|
||||
: WVisibility.Collapsed;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// detach all events before disposing
|
||||
var controller = (ISKCanvasViewController)Element;
|
||||
if (controller != null)
|
||||
{
|
||||
controller.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
controller.GetCanvasSize -= OnGetCanvasSize;
|
||||
}
|
||||
|
||||
var control = Control;
|
||||
if (control != null)
|
||||
{
|
||||
control.PaintSurface -= OnPaintSurface;
|
||||
}
|
||||
|
||||
// detach, regardless of state
|
||||
touchHandler.Detach(control);
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private SKPoint GetScaledCoord(double x, double y)
|
||||
{
|
||||
if (Element.IgnorePixelScaling)
|
||||
{
|
||||
#if __ANDROID__
|
||||
x = Context.FromPixels(x);
|
||||
y = Context.FromPixels(y);
|
||||
#elif __TIZEN__
|
||||
x = Tizen.ScalingInfo.FromPixel(x);
|
||||
y = Tizen.ScalingInfo.FromPixel(y);
|
||||
#elif __IOS__ || WINDOWS
|
||||
// Tizen and Android are the reverse of the other platforms
|
||||
#else
|
||||
#error Missing platform logic
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if __ANDROID__ || __TIZEN__
|
||||
// Tizen and Android are the reverse of the other platforms
|
||||
#elif __IOS__
|
||||
x = x * Control.ContentScaleFactor;
|
||||
y = y * Control.ContentScaleFactor;
|
||||
#elif WINDOWS
|
||||
x = x * Control.Dpi;
|
||||
y = y * Control.Dpi;
|
||||
#else
|
||||
#error Missing platform logic
|
||||
#endif
|
||||
}
|
||||
|
||||
return new SKPoint((float)x, (float)y);
|
||||
}
|
||||
|
||||
private void OnPaintSurface(object sender, SKNativePaintSurfaceEventArgs e)
|
||||
{
|
||||
var controller = Element as ISKCanvasViewController;
|
||||
|
||||
// the control is being repainted, let the user know
|
||||
controller?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info, e.RawInfo));
|
||||
}
|
||||
|
||||
private void OnSurfaceInvalidated(object sender, EventArgs eventArgs)
|
||||
{
|
||||
// repaint the native control
|
||||
#if __IOS__
|
||||
Control.SetNeedsDisplay();
|
||||
#else
|
||||
Control.Invalidate();
|
||||
#endif
|
||||
}
|
||||
|
||||
// the user asked for the size
|
||||
private void OnGetCanvasSize(object sender, GetPropertyValueEventArgs<SKSize> e)
|
||||
{
|
||||
e.Value = Control?.CanvasSize ?? SKSize.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using Android.Content;
|
||||
using Android.Opengl;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
|
||||
using SKNativeView = SkiaSharp.Views.Android.SKGLTextureView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKGLViewRenderer : SKGLViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
public SKGLViewRenderer(Context context)
|
||||
: base(context)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void SetupRenderLoop(bool oneShot)
|
||||
{
|
||||
if (oneShot)
|
||||
{
|
||||
Control.RequestRender();
|
||||
}
|
||||
|
||||
Control.RenderMode = Element.HasRenderLoop
|
||||
? Rendermode.Continuously
|
||||
: Rendermode.WhenDirty;
|
||||
}
|
||||
|
||||
protected override SKNativeView CreateNativeControl()
|
||||
{
|
||||
var view = GetType() == typeof(SKGLViewRenderer)
|
||||
? new SKNativeView(Context)
|
||||
: base.CreateNativeControl();
|
||||
|
||||
// Force the opacity to false for consistency with the other platforms
|
||||
view.SetOpaque(false);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
internal class SKGLViewRenderer
|
||||
{
|
||||
public SKGLViewRenderer()
|
||||
{
|
||||
throw new System.PlatformNotSupportedException("SKGLView is not yet supported on this platform.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
#if !__TIZEN__
|
||||
using System;
|
||||
using SkiaSharp.Views.Tizen;
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
using TForms = Microsoft.Maui.Controls.Compatibility.Forms;
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
|
||||
using SKNativeView = SkiaSharp.Views.Tizen.SKGLSurfaceView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKGLViewRenderer : SKGLViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override SKNativeView CreateNativeControl() =>
|
||||
GetType() == typeof(SKGLViewRenderer)
|
||||
? new SKNativeView(TForms.NativeParent)
|
||||
: base.CreateNativeControl();
|
||||
|
||||
protected override void SetupRenderLoop(bool oneShot)
|
||||
{
|
||||
if (oneShot)
|
||||
{
|
||||
Control.Invalidate();
|
||||
}
|
||||
|
||||
Control.RenderingMode = Element.HasRenderLoop ? RenderingMode.Continuously : RenderingMode.WhenDirty;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||
#if !WINDOWS
|
||||
using System;
|
||||
using Microsoft.Maui;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Compatibility;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
|
||||
using SKNativeView = SkiaSharp.Views.Windows.SKSwapChainPanel;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKGLViewRenderer : SKGLViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
protected override SKNativeView CreateNativeControl() =>
|
||||
GetType() == typeof(SKGLViewRenderer)
|
||||
? new SKNativeView()
|
||||
: base.CreateNativeControl();
|
||||
|
||||
protected override void SetupRenderLoop(bool oneShot)
|
||||
{
|
||||
if (oneShot)
|
||||
{
|
||||
Control.Invalidate();
|
||||
}
|
||||
|
||||
Control.EnableRenderLoop = Element.HasRenderLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,90 +0,0 @@
|
|||
#if !__MACCATALYST__
|
||||
using System;
|
||||
using CoreAnimation;
|
||||
using Foundation;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
|
||||
using SKNativeView = SkiaSharp.Views.iOS.SKGLView;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public class SKGLViewRenderer : SKGLViewRendererBase<SKFormsView, SKNativeView>
|
||||
{
|
||||
private CADisplayLink displayLink;
|
||||
|
||||
public SKGLViewRenderer()
|
||||
{
|
||||
SetDisablesUserInteraction(true);
|
||||
}
|
||||
|
||||
protected override SKNativeView CreateNativeControl()
|
||||
{
|
||||
var view = GetType() == typeof(SKGLViewRenderer)
|
||||
? new SKNativeView()
|
||||
: base.CreateNativeControl();
|
||||
|
||||
// Force the opacity to false for consistency with the other platforms
|
||||
view.Opaque = false;
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// stop the render loop
|
||||
if (displayLink != null)
|
||||
{
|
||||
displayLink.Invalidate();
|
||||
displayLink.Dispose();
|
||||
displayLink = null;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void SetupRenderLoop(bool oneShot)
|
||||
{
|
||||
// only start if we haven't already
|
||||
if (displayLink != null)
|
||||
return;
|
||||
|
||||
// bail out if we are requesting something that the view doesn't want to
|
||||
if (!oneShot && !Element.HasRenderLoop)
|
||||
return;
|
||||
|
||||
// if this is a one shot request, don't bother with the display link
|
||||
if (oneShot)
|
||||
{
|
||||
var nativeView = Control;
|
||||
nativeView?.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
if (nativeView.Handle != IntPtr.Zero)
|
||||
nativeView.Display();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// create the loop
|
||||
displayLink = CADisplayLink.Create(() =>
|
||||
{
|
||||
var nativeView = Control;
|
||||
var formsView = Element;
|
||||
|
||||
// stop the render loop if this was a one-shot, or the views are disposed
|
||||
if (nativeView == null || formsView == null || nativeView.Handle == IntPtr.Zero || !formsView.HasRenderLoop)
|
||||
{
|
||||
displayLink.Invalidate();
|
||||
displayLink.Dispose();
|
||||
displayLink = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// redraw the view
|
||||
nativeView.Display();
|
||||
});
|
||||
displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Default);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,223 +0,0 @@
|
|||
#if !WINDOWS && !__MACCATALYST__ && !NETSTANDARD && !__TIZEN__
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
using SkiaSharp.Views.Maui.Platform;
|
||||
|
||||
using SKFormsView = SkiaSharp.Views.Maui.Controls.SKGLView;
|
||||
|
||||
#if __ANDROID__
|
||||
using Android.Content;
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using SKNativeView = SkiaSharp.Views.Android.SKGLTextureView;
|
||||
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.Android.SKPaintGLSurfaceEventArgs;
|
||||
#elif __IOS__
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using SKNativeView = SkiaSharp.Views.iOS.SKGLView;
|
||||
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.iOS.SKPaintGLSurfaceEventArgs;
|
||||
#elif __TIZEN__
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.Tizen;
|
||||
using TForms = Microsoft.Maui.Controls.Compatibility.Forms;
|
||||
using SKNativeView = SkiaSharp.Views.Tizen.NUI.SKGLSurfaceView;
|
||||
using SKNativePaintGLSurfaceEventArgs = SkiaSharp.Views.Tizen.SKPaintGLSurfaceEventArgs;
|
||||
#endif
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility
|
||||
{
|
||||
[Obsolete("View renderers are obsolete in .NET MAUI. Use the handlers instead.")]
|
||||
public abstract class SKGLViewRendererBase<TFormsView, TNativeView> : ViewRenderer<TFormsView, TNativeView>
|
||||
where TFormsView : SKFormsView
|
||||
where TNativeView : SKNativeView
|
||||
{
|
||||
private SKTouchHandler touchHandler;
|
||||
|
||||
#if __ANDROID__
|
||||
protected SKGLViewRendererBase(Context context)
|
||||
: base(context)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
#else
|
||||
protected SKGLViewRendererBase()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
touchHandler = new SKTouchHandler(
|
||||
args => ((ISKGLViewController)Element).OnTouch(args),
|
||||
(x, y) => GetScaledCoord(x, y));
|
||||
}
|
||||
|
||||
public GRContext GRContext => Control.GRContext;
|
||||
|
||||
#if __IOS__
|
||||
protected void SetDisablesUserInteraction(bool disablesUserInteraction)
|
||||
{
|
||||
touchHandler.DisablesUserInteraction = disablesUserInteraction;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<TFormsView> e)
|
||||
{
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
var oldController = (ISKGLViewController)e.OldElement;
|
||||
|
||||
// unsubscribe from events
|
||||
oldController.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
oldController.GetCanvasSize -= OnGetCanvasSize;
|
||||
oldController.GetGRContext -= OnGetGRContext;
|
||||
}
|
||||
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
var newController = (ISKGLViewController)e.NewElement;
|
||||
|
||||
// create the native view
|
||||
if (Control == null)
|
||||
{
|
||||
var view = CreateNativeControl();
|
||||
view.PaintSurface += OnPaintSurface;
|
||||
SetNativeControl(view);
|
||||
}
|
||||
|
||||
touchHandler.SetEnabled(Control, e.NewElement.EnableTouchEvents);
|
||||
|
||||
// subscribe to events from the user
|
||||
newController.SurfaceInvalidated += OnSurfaceInvalidated;
|
||||
newController.GetCanvasSize += OnGetCanvasSize;
|
||||
newController.GetGRContext += OnGetGRContext;
|
||||
|
||||
// start the rendering
|
||||
SetupRenderLoop(false);
|
||||
}
|
||||
|
||||
base.OnElementChanged(e);
|
||||
}
|
||||
|
||||
#if __ANDROID__
|
||||
protected override TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView), new[] { Context });
|
||||
}
|
||||
#elif __TIZEN__
|
||||
protected virtual TNativeView CreateNativeControl()
|
||||
{
|
||||
TNativeView ret = (TNativeView)Activator.CreateInstance(typeof(TNativeView), new[] { TForms.NativeParent });
|
||||
return ret;
|
||||
}
|
||||
#elif __IOS__
|
||||
protected override TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView));
|
||||
}
|
||||
#else
|
||||
protected virtual TNativeView CreateNativeControl()
|
||||
{
|
||||
return (TNativeView)Activator.CreateInstance(typeof(TNativeView));
|
||||
}
|
||||
#endif
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
|
||||
// refresh the render loop
|
||||
if (e.PropertyName == SKFormsView.HasRenderLoopProperty.PropertyName)
|
||||
{
|
||||
SetupRenderLoop(false);
|
||||
}
|
||||
else if (e.PropertyName == SKFormsView.EnableTouchEventsProperty.PropertyName)
|
||||
{
|
||||
touchHandler.SetEnabled(Control, Element.EnableTouchEvents);
|
||||
}
|
||||
#if WINDOWS
|
||||
else if (e.PropertyName == Xamarin.Forms.VisualElement.IsVisibleProperty.PropertyName)
|
||||
{
|
||||
// pass the visibility down to the view do disable drawing
|
||||
Control.Visibility = Element.IsVisible
|
||||
? Windows.UI.Xaml.Visibility.Visible
|
||||
: Windows.UI.Xaml.Visibility.Collapsed;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// detach all events before disposing
|
||||
var controller = (ISKGLViewController)Element;
|
||||
if (controller != null)
|
||||
{
|
||||
controller.SurfaceInvalidated -= OnSurfaceInvalidated;
|
||||
controller.GetCanvasSize -= OnGetCanvasSize;
|
||||
controller.GetGRContext -= OnGetGRContext;
|
||||
}
|
||||
|
||||
var control = Control;
|
||||
if (control != null)
|
||||
{
|
||||
control.PaintSurface -= OnPaintSurface;
|
||||
}
|
||||
|
||||
// detach, regardless of state
|
||||
touchHandler.Detach(control);
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected abstract void SetupRenderLoop(bool oneShot);
|
||||
|
||||
private SKPoint GetScaledCoord(double x, double y)
|
||||
{
|
||||
#if __ANDROID__ || __TIZEN__
|
||||
// Android and Tizen are the reverse of the other platforms
|
||||
#elif __IOS__
|
||||
x = x * Control.ContentScaleFactor;
|
||||
y = y * Control.ContentScaleFactor;
|
||||
#elif WINDOWS
|
||||
x = x * Control.ContentsScale;
|
||||
y = y * Control.ContentsScale;
|
||||
#else
|
||||
#error Missing platform logic
|
||||
#endif
|
||||
|
||||
return new SKPoint((float)x, (float)y);
|
||||
}
|
||||
|
||||
|
||||
// the user asked to repaint
|
||||
private void OnSurfaceInvalidated(object sender, EventArgs eventArgs)
|
||||
{
|
||||
// if we aren't in a loop, then refresh once
|
||||
if (!Element.HasRenderLoop)
|
||||
{
|
||||
SetupRenderLoop(true);
|
||||
}
|
||||
}
|
||||
|
||||
// the user asked for the size
|
||||
private void OnGetCanvasSize(object sender, GetPropertyValueEventArgs<SKSize> e)
|
||||
{
|
||||
e.Value = Control?.CanvasSize ?? SKSize.Empty;
|
||||
}
|
||||
|
||||
// the user asked for the current GRContext
|
||||
private void OnGetGRContext(object sender, GetPropertyValueEventArgs<GRContext> e)
|
||||
{
|
||||
e.Value = Control?.GRContext;
|
||||
}
|
||||
|
||||
private void OnPaintSurface(object sender, SKNativePaintGLSurfaceEventArgs e)
|
||||
{
|
||||
var controller = Element as ISKGLViewController;
|
||||
|
||||
// the control is being repainted, let the user know
|
||||
controller?.OnPaintSurface(new SKPaintGLSurfaceEventArgs(e.Surface, e.BackendRenderTarget));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,55 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>$(MauiTargetFrameworks)</TargetFrameworks>
|
||||
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
|
||||
<PackagingGroup>SkiaSharp.Views.Maui.Controls.Compatibility</PackagingGroup>
|
||||
<RootNamespace>SkiaSharp.Views.Maui.Controls.Compatibility</RootNamespace>
|
||||
<AssemblyName>SkiaSharp.Views.Maui.Controls.Compatibility</AssemblyName>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
<DefineConstants>$(DefineConstants);__MAUI__</DefineConstants>
|
||||
<PackagingPlatform Condition="$(TargetFramework.Contains('-windows'))">net$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)'))-windows</PackagingPlatform>
|
||||
<UseMaui>true</UseMaui>
|
||||
<AndroidGenerateResourceDesigner>false</AndroidGenerateResourceDesigner>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<WindowsAppSdkBootstrapInitialize>false</WindowsAppSdkBootstrapInitialize>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
|
||||
<ProjectReference Include="..\SkiaSharp.Views.Maui.Core\SkiaSharp.Views.Maui.Core.csproj" />
|
||||
<ProjectReference Include="..\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SkiaSharp.Views.Maui.Core\Properties\SkiaSharpViewsMauiAssemblyInfo.cs" Link="Properties\SkiaSharpViewsMauiAssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.Contains('-'))">
|
||||
<Compile Remove="**\Ref\**\*.cs" />
|
||||
<None Include="**\Ref\**\*.cs" />
|
||||
<Compile Remove="**\*.Ref.cs" />
|
||||
<None Include="**\*.Ref.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.Contains('-ios')) and !$(TargetFramework.Contains('-maccatalyst'))">
|
||||
<Compile Remove="**\iOS\**\*.cs" />
|
||||
<None Include="**\iOS\**\*.cs" />
|
||||
<Compile Remove="**\*.iOS.cs" />
|
||||
<None Include="**\*.iOS.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.Contains('-android'))">
|
||||
<Compile Remove="**\Android\**\*.cs" />
|
||||
<None Include="**\Android\**\*.cs" />
|
||||
<Compile Remove="**\*.Android.cs" />
|
||||
<None Include="**\*.Android.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.Contains('-windows'))">
|
||||
<Compile Remove="**\Windows\**\*.cs" />
|
||||
<None Include="**\Windows\**\*.cs" />
|
||||
<Compile Remove="**\*.Windows.cs" />
|
||||
<None Include="**\*.Windows.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="!$(TargetFramework.Contains('-tizen'))">
|
||||
<Compile Remove="**\Tizen\**\*.cs" />
|
||||
<None Include="**\Tizen\**\*.cs" />
|
||||
<Compile Remove="**\*.Tizen.cs" />
|
||||
<None Include="**\*.Tizen.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -4,16 +4,6 @@ using Microsoft.Maui.Hosting;
|
|||
using SkiaSharp.Views.Maui.Controls.Hosting;
|
||||
using SkiaSharp.Views.Maui.Handlers;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls
|
||||
{
|
||||
[Obsolete("Use SkiaSharp.Views.Maui.Controls.Hosting instead.", true)]
|
||||
public static class AppHostBuilderExtensions
|
||||
{
|
||||
[Obsolete("Use SkiaSharp.Views.Maui.Controls.Hosting.UseSkiaSharp() instead.", true)]
|
||||
public static MauiAppBuilder UseSkiaSharpHandlers(this MauiAppBuilder builder) => builder.UseSkiaSharp();
|
||||
}
|
||||
}
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Hosting
|
||||
{
|
||||
public static class AppHostBuilderExtensions
|
||||
|
|
|
@ -11,4 +11,3 @@ using System.Runtime.CompilerServices;
|
|||
|
||||
[assembly: InternalsVisibleTo("SkiaSharp.Views.Maui.Core")]
|
||||
[assembly: InternalsVisibleTo("SkiaSharp.Views.Maui.Controls")]
|
||||
[assembly: InternalsVisibleTo("SkiaSharp.Views.Maui.Controls.Compatibility")]
|
||||
|
|
|
@ -142,9 +142,7 @@ namespace SkiaSharp.Views.UWP
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo));
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType));
|
||||
}
|
||||
|
||||
// update the control
|
||||
|
|
|
@ -25,25 +25,6 @@ namespace SkiaSharp.Views.Blazor
|
|||
{
|
||||
public class SKPaintGLSurfaceEventArgs : EventArgs
|
||||
{
|
||||
#if !__BLAZOR__
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
private GRBackendRenderTargetDesc? rtDesc;
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKPaintGLSurfaceEventArgs(SKSurface, GRBackendRenderTarget, SKColorType, GRSurfaceOrigin) instead.")]
|
||||
public SKPaintGLSurfaceEventArgs(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
Surface = surface;
|
||||
rtDesc = renderTarget;
|
||||
BackendRenderTarget = new GRBackendRenderTarget(GRBackend.OpenGL, renderTarget);
|
||||
ColorType = renderTarget.Config.ToColorType();
|
||||
Origin = renderTarget.Origin;
|
||||
Info = new SKImageInfo(renderTarget.Width, renderTarget.Height, ColorType);
|
||||
RawInfo = Info;
|
||||
}
|
||||
#endif
|
||||
|
||||
public SKPaintGLSurfaceEventArgs(SKSurface surface, GRBackendRenderTarget renderTarget)
|
||||
: this(surface, renderTarget, GRSurfaceOrigin.BottomLeft, SKColorType.Rgba8888)
|
||||
{
|
||||
|
@ -74,42 +55,8 @@ namespace SkiaSharp.Views.Blazor
|
|||
RawInfo = rawInfo;
|
||||
}
|
||||
|
||||
#if !__BLAZOR__
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKPaintGLSurfaceEventArgs(SKSurface, GRBackendRenderTarget, GRSurfaceOrigin, SKColorType) instead.")]
|
||||
public SKPaintGLSurfaceEventArgs(SKSurface surface, GRBackendRenderTarget renderTarget, GRSurfaceOrigin origin, SKColorType colorType, GRGlFramebufferInfo glInfo)
|
||||
{
|
||||
Surface = surface;
|
||||
BackendRenderTarget = renderTarget;
|
||||
ColorType = colorType;
|
||||
Origin = origin;
|
||||
rtDesc = CreateDesc(glInfo);
|
||||
Info = new SKImageInfo(renderTarget.Width, renderTarget.Height, colorType);
|
||||
RawInfo = Info;
|
||||
}
|
||||
#endif
|
||||
|
||||
public SKSurface Surface { get; private set; }
|
||||
|
||||
#if !__BLAZOR__
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use BackendRenderTarget instead.")]
|
||||
public GRBackendRenderTargetDesc RenderTarget => rtDesc ??= CreateDesc(BackendRenderTarget.GetGlFramebufferInfo());
|
||||
|
||||
[Obsolete]
|
||||
private GRBackendRenderTargetDesc CreateDesc(GRGlFramebufferInfo glInfo) =>
|
||||
new GRBackendRenderTargetDesc
|
||||
{
|
||||
Width = BackendRenderTarget.Width,
|
||||
Height = BackendRenderTarget.Height,
|
||||
RenderTargetHandle = (IntPtr)glInfo.FramebufferObjectId,
|
||||
SampleCount = BackendRenderTarget.SampleCount,
|
||||
StencilBits = BackendRenderTarget.StencilBits,
|
||||
Config = ColorType.ToPixelConfig(),
|
||||
Origin = Origin,
|
||||
};
|
||||
#endif
|
||||
|
||||
public GRBackendRenderTarget BackendRenderTarget { get; private set; }
|
||||
|
||||
public SKColorType ColorType { get; private set; }
|
||||
|
|
|
@ -112,9 +112,7 @@ namespace SkiaSharp.Views.Desktop
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo));
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
OnPaintSurface(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType));
|
||||
}
|
||||
|
||||
// update the control
|
||||
|
|
|
@ -111,9 +111,6 @@ namespace SkiaSharp.Views.Android
|
|||
|
||||
// draw using SkiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
OnDraw(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
// draw the surface to the view
|
||||
surfaceFactory.DrawSurface(surface, canvas);
|
||||
|
@ -134,12 +131,6 @@ namespace SkiaSharp.Views.Android
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintSurfaceEventArgs) instead.")]
|
||||
protected virtual void OnDraw(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDetachedFromWindow()
|
||||
{
|
||||
surfaceFactory.Dispose();
|
||||
|
|
|
@ -10,10 +10,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
private SKGLSurfaceViewRenderer renderer;
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
private ISKRenderer skRenderer;
|
||||
|
||||
public SKGLSurfaceView(Context context)
|
||||
: base(context)
|
||||
{
|
||||
|
@ -46,20 +42,6 @@ namespace SkiaSharp.Views.Android
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use PaintSurface instead.")]
|
||||
public virtual void SetRenderer(ISKRenderer renderer)
|
||||
{
|
||||
skRenderer = renderer;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKGLSurfaceView.PaintSurface instead.")]
|
||||
public interface ISKRenderer
|
||||
{
|
||||
void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget);
|
||||
}
|
||||
|
||||
private class InternalRenderer : SKGLSurfaceViewRenderer
|
||||
{
|
||||
private readonly SKGLSurfaceView surfaceView;
|
||||
|
@ -73,13 +55,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
surfaceView.OnPaintSurface(e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
protected override void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
surfaceView.skRenderer?.OnDrawFrame(surface, renderTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,12 +29,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
protected virtual void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDrawFrame(IGL10 gl)
|
||||
{
|
||||
GLES20.GlClear(GLES20.GlColorBufferBit | GLES20.GlDepthBufferBit | GLES20.GlStencilBufferBit);
|
||||
|
@ -83,11 +77,8 @@ namespace SkiaSharp.Views.Android
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
OnDrawFrame(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
// flush the SkiaSharp contents to GL
|
||||
|
|
|
@ -21,10 +21,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
private SKGLTextureViewRenderer renderer;
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete]
|
||||
private ISKRenderer skRenderer;
|
||||
|
||||
public SKGLTextureView(Context context)
|
||||
: base(context)
|
||||
{
|
||||
|
@ -57,20 +53,6 @@ namespace SkiaSharp.Views.Android
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use PaintSurface instead.")]
|
||||
public virtual void SetRenderer(ISKRenderer renderer)
|
||||
{
|
||||
skRenderer = renderer;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKGLTextureView.PaintSurface instead.")]
|
||||
public interface ISKRenderer
|
||||
{
|
||||
void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget);
|
||||
}
|
||||
|
||||
private class InternalRenderer : SKGLTextureViewRenderer
|
||||
{
|
||||
private readonly SKGLTextureView textureView;
|
||||
|
@ -84,13 +66,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
textureView.OnPaintSurface(e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
protected override void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
textureView.skRenderer?.OnDrawFrame(surface, renderTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,6 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
protected virtual void OnDrawFrame(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnDrawFrame(IGL10 gl)
|
||||
{
|
||||
GLES10.GlClear(GLES10.GlColorBufferBit | GLES10.GlDepthBufferBit | GLES10.GlStencilBufferBit);
|
||||
|
@ -94,11 +88,8 @@ namespace SkiaSharp.Views.Android
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
OnDrawFrame(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
// flush the SkiaSharp contents to GL
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
#if __TVOS__
|
||||
namespace SkiaSharp.Views.tvOS
|
||||
#elif __IOS__
|
||||
namespace SkiaSharp.Views.iOS
|
||||
#elif __MACOS__
|
||||
namespace SkiaSharp.Views.Mac
|
||||
#endif
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKCanvasLayer.PaintSurface instead.")]
|
||||
public interface ISKCanvasLayerDelegate
|
||||
{
|
||||
void DrawInSurface(SKSurface surface, SKImageInfo info);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
#if __TVOS__
|
||||
namespace SkiaSharp.Views.tvOS
|
||||
#elif __IOS__
|
||||
namespace SkiaSharp.Views.iOS
|
||||
#elif __MACOS__
|
||||
namespace SkiaSharp.Views.Mac
|
||||
#endif
|
||||
{
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use SKGLLayer.PaintSurface instead.")]
|
||||
public interface ISKGLLayerDelegate
|
||||
{
|
||||
void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget);
|
||||
}
|
||||
}
|
|
@ -24,10 +24,6 @@ namespace SkiaSharp.Views.Mac
|
|||
NeedsDisplayOnBoundsChange = true;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use PaintSurface instead.")]
|
||||
public ISKCanvasLayerDelegate SKDelegate { get; set; }
|
||||
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
|
@ -68,10 +64,6 @@ namespace SkiaSharp.Views.Mac
|
|||
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
SKDelegate?.DrawInSurface(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
// draw the surface to the context
|
||||
drawable.DrawSurface(ctx, Bounds, info, surface);
|
||||
|
@ -84,12 +76,6 @@ namespace SkiaSharp.Views.Mac
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
|
|
@ -110,9 +110,7 @@ namespace SkiaSharp.Views.Tizen
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// draw using SkiaSharp
|
||||
#pragma warning disable CS0612 // Type or member is obsolete
|
||||
OnDrawFrame(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo));
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
OnDrawFrame(new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType));
|
||||
}
|
||||
|
||||
// flush the SkiaSharp contents to GL
|
||||
|
|
|
@ -109,9 +109,6 @@ namespace SkiaSharp.Views.iOS
|
|||
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
// draw the surface to the context
|
||||
drawable.DrawSurface(ctx, Bounds, info, surface);
|
||||
|
@ -138,12 +135,6 @@ namespace SkiaSharp.Views.iOS
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
}
|
||||
|
||||
public override void LayoutSubviews()
|
||||
{
|
||||
base.LayoutSubviews();
|
||||
|
|
|
@ -36,10 +36,6 @@ namespace SkiaSharp.Views.iOS
|
|||
Opaque = true;
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use PaintSurface instead.")]
|
||||
public ISKGLLayerDelegate SKDelegate { get; set; }
|
||||
|
||||
public SKSize CanvasSize => lastSize;
|
||||
|
||||
public GRContext GRContext => context;
|
||||
|
@ -97,12 +93,8 @@ namespace SkiaSharp.Views.iOS
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
DrawInSurface(e.Surface, e.RenderTarget);
|
||||
SKDelegate?.DrawInSurface(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
// flush the SkiaSharp context to the GL context
|
||||
|
@ -135,12 +127,6 @@ namespace SkiaSharp.Views.iOS
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
|
||||
private void PrepareGLContexts()
|
||||
{
|
||||
// create GL context
|
||||
|
|
|
@ -148,11 +148,8 @@ namespace SkiaSharp.Views.iOS
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
DrawInSurface(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
// flush the SkiaSharp contents to GL
|
||||
|
@ -167,12 +164,6 @@ namespace SkiaSharp.Views.iOS
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
|
||||
public override CGRect Frame
|
||||
{
|
||||
get { return base.Frame; }
|
||||
|
|
|
@ -62,12 +62,6 @@ namespace SkiaSharp.Views.Mac
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DrawRect(CGRect dirtyRect)
|
||||
{
|
||||
base.DrawRect(dirtyRect);
|
||||
|
@ -98,9 +92,6 @@ namespace SkiaSharp.Views.Mac
|
|||
{
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
||||
// draw the surface to the context
|
||||
drawable.DrawSurface(ctx, Bounds, info, surface);
|
||||
|
|
|
@ -26,10 +26,6 @@ namespace SkiaSharp.Views.Mac
|
|||
NeedsDisplayOnBoundsChange = true;
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use PaintSurface instead.")]
|
||||
public ISKGLLayerDelegate SKDelegate { get; set; }
|
||||
|
||||
public SKSize CanvasSize => lastSize;
|
||||
|
||||
public GRContext GRContext => context;
|
||||
|
@ -41,12 +37,6 @@ namespace SkiaSharp.Views.Mac
|
|||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DrawInCGLContext(CGLContext glContext, CGLPixelFormat pixelFormat, double timeInterval, ref CVTimeStamp timeStamp)
|
||||
{
|
||||
CGLContext.CurrentContext = glContext;
|
||||
|
@ -96,12 +86,8 @@ namespace SkiaSharp.Views.Mac
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
DrawInSurface(e.Surface, e.RenderTarget);
|
||||
SKDelegate?.DrawInSurface(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
}
|
||||
|
||||
// flush the SkiaSharp context to the GL context
|
||||
|
|
|
@ -164,10 +164,7 @@ namespace SkiaSharp.Views.Mac
|
|||
using (new SKAutoCanvasRestore(canvas, true))
|
||||
{
|
||||
// start drawing
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType, glInfo);
|
||||
DrawInSurface(e.Surface, e.RenderTarget);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
var e = new SKPaintGLSurfaceEventArgs(surface, renderTarget, surfaceOrigin, colorType);
|
||||
OnPaintSurface(e);
|
||||
}
|
||||
|
||||
|
@ -184,11 +181,5 @@ namespace SkiaSharp.Views.Mac
|
|||
{
|
||||
PaintSurface?.Invoke(this, e);
|
||||
}
|
||||
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Use OnPaintSurface(SKPaintGLSurfaceEventArgs) instead.")]
|
||||
public virtual void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
"..\\binding\\SkiaSharp\\SkiaSharp.csproj",
|
||||
"SkiaSharp.DotNet.Interactive\\SkiaSharp.DotNet.Interactive.csproj",
|
||||
"SkiaSharp.HarfBuzz\\SkiaSharp.HarfBuzz\\SkiaSharp.HarfBuzz.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls.Compatibility\\SkiaSharp.Views.Maui.Controls.Compatibility.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls\\SkiaSharp.Views.Maui.Controls.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Core\\SkiaSharp.Views.Maui.Core.csproj",
|
||||
"SkiaSharp.Views.Uno\\SkiaSharp.Views.Uno.WinUI.Skia\\SkiaSharp.Views.Uno.WinUI.Skia.csproj",
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
"..\\binding\\SkiaSharp\\SkiaSharp.csproj",
|
||||
"SkiaSharp.DotNet.Interactive\\SkiaSharp.DotNet.Interactive.csproj",
|
||||
"SkiaSharp.HarfBuzz\\SkiaSharp.HarfBuzz\\SkiaSharp.HarfBuzz.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls.Compatibility\\SkiaSharp.Views.Maui.Controls.Compatibility.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Controls\\SkiaSharp.Views.Maui.Controls.csproj",
|
||||
"SkiaSharp.Views.Maui\\SkiaSharp.Views.Maui.Core\\SkiaSharp.Views.Maui.Core.csproj",
|
||||
"SkiaSharp.Views.Uno\\SkiaSharp.Views.Uno.WinUI.Skia\\SkiaSharp.Views.Uno.WinUI.Skia.csproj",
|
||||
|
|
|
@ -107,8 +107,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "binding", "binding", "{937A
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{21E35524-DFEB-462F-84DD-A81213A38EEA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls.Compatibility", "SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj", "{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -271,10 +269,6 @@ Global
|
|||
{1DE3BDD6-344B-4927-BC67-DAA80C691F6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DE3BDD6-344B-4927-BC67-DAA80C691F6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DE3BDD6-344B-4927-BC67-DAA80C691F6C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -330,7 +324,6 @@ Global
|
|||
{DD1EAB2E-29FD-4971-8440-055A1A1E69BA} = {2F28C1EB-D020-4A3A-948F-DF0AD0FDCC53}
|
||||
{2B4DCCF7-8BF3-4027-9A79-344BFBD21B6D} = {2F28C1EB-D020-4A3A-948F-DF0AD0FDCC53}
|
||||
{1DE3BDD6-344B-4927-BC67-DAA80C691F6C} = {2F28C1EB-D020-4A3A-948F-DF0AD0FDCC53}
|
||||
{3BCD1D0F-07EF-4E6A-B242-3D779039E7B3} = {47A83C7D-EEAB-4149-A58B-CA179DDCB101}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {67EACD19-0CEA-4127-9842-549AA6FB84C9}
|
||||
|
|
|
@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Core",
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls", "..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj", "{72C22D09-AC66-4D5A-B503-D7CDA2AD6A3B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Maui.Controls.Compatibility", "..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj", "{A07895A8-8673-4B91-8EA8-21093CF6D667}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{6779122B-72B0-42ED-A1E7-5029C1C0A78D}"
|
||||
EndProject
|
||||
Global
|
||||
|
@ -75,10 +73,6 @@ Global
|
|||
{72C22D09-AC66-4D5A-B503-D7CDA2AD6A3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{72C22D09-AC66-4D5A-B503-D7CDA2AD6A3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{72C22D09-AC66-4D5A-B503-D7CDA2AD6A3B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A07895A8-8673-4B91-8EA8-21093CF6D667}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A07895A8-8673-4B91-8EA8-21093CF6D667}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A07895A8-8673-4B91-8EA8-21093CF6D667}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A07895A8-8673-4B91-8EA8-21093CF6D667}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -92,7 +86,6 @@ Global
|
|||
{398936B0-1B68-4F2D-B91C-6880CAC9F168} = {6779122B-72B0-42ED-A1E7-5029C1C0A78D}
|
||||
{CB3FAE69-DE1F-47FF-A158-B0EF8F5F8AF6} = {6779122B-72B0-42ED-A1E7-5029C1C0A78D}
|
||||
{72C22D09-AC66-4D5A-B503-D7CDA2AD6A3B} = {6779122B-72B0-42ED-A1E7-5029C1C0A78D}
|
||||
{A07895A8-8673-4B91-8EA8-21093CF6D667} = {6779122B-72B0-42ED-A1E7-5029C1C0A78D}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {34FFBC0E-9245-423A-9A91-687C9B7FDB8B}
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
<ProjectReference Include="..\..\source\SkiaSharp.Views\SkiaSharp.Views\SkiaSharp.Views.csproj" />
|
||||
<ProjectReference Include="..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Core\SkiaSharp.Views.Maui.Core.csproj" />
|
||||
<ProjectReference Include="..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls\SkiaSharp.Views.Maui.Controls.csproj" />
|
||||
<ProjectReference Include="..\..\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj" />
|
||||
<ProjectReference Include="..\SkiaSharp.Tests\SkiaSharp.Tests.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using SkiaSharp.Views.Android.Tests;
|
||||
using Xunit;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility.Tests
|
||||
{
|
||||
public class SKImageSourceHandlerTests : AndroidTests
|
||||
{
|
||||
private readonly SKImageSourceHandler handler;
|
||||
|
||||
public SKImageSourceHandlerTests()
|
||||
{
|
||||
handler = new SKImageSourceHandler();
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task PixelBackedImageToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var image = SKImage.FromBitmap(bitmap);
|
||||
|
||||
var source = (SKImageImageSource)image;
|
||||
|
||||
using var androidBitmap = await handler.LoadImageAsync(source, Application.Context);
|
||||
|
||||
ValidateTestBitmap(androidBitmap, alpha);
|
||||
|
||||
androidBitmap.Recycle();
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task BitmapToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
|
||||
var source = (SKBitmapImageSource)bitmap;
|
||||
|
||||
using var androidBitmap = await handler.LoadImageAsync(source, Application.Context);
|
||||
|
||||
ValidateTestBitmap(androidBitmap, alpha);
|
||||
|
||||
androidBitmap.Recycle();
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task PixmapToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var pixmap = bitmap.PeekPixels();
|
||||
|
||||
var source = (SKPixmapImageSource)pixmap;
|
||||
|
||||
using var androidBitmap = await handler.LoadImageAsync(source, Application.Context);
|
||||
|
||||
ValidateTestBitmap(androidBitmap, alpha);
|
||||
|
||||
androidBitmap.Recycle();
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task EncodedDataBackedImageToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var data = bitmap.Encode(SKEncodedImageFormat.Png, 100);
|
||||
using var image = SKImage.FromEncodedData(data);
|
||||
|
||||
var source = (SKImageImageSource)image;
|
||||
|
||||
using var androidBitmap = await handler.LoadImageAsync(source, Application.Context);
|
||||
|
||||
ValidateTestBitmap(androidBitmap, alpha);
|
||||
|
||||
androidBitmap.Recycle();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
using System.Threading.Tasks;
|
||||
using SkiaSharp.Views.iOS.Tests;
|
||||
using Xunit;
|
||||
|
||||
namespace SkiaSharp.Views.Maui.Controls.Compatibility.Tests
|
||||
{
|
||||
public class SKImageSourceHandlerTests : iOSTests
|
||||
{
|
||||
private readonly SKImageSourceHandler handler;
|
||||
|
||||
public SKImageSourceHandlerTests()
|
||||
{
|
||||
handler = new SKImageSourceHandler();
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task PixelBackedImageToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var image = SKImage.FromBitmap(bitmap);
|
||||
|
||||
var source = (SKImageImageSource)image;
|
||||
|
||||
using var uiImage = await handler.LoadImageAsync(source);
|
||||
|
||||
ValidateTestBitmap(uiImage, alpha);
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task BitmapToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
|
||||
var source = (SKBitmapImageSource)bitmap;
|
||||
|
||||
using var uiImage = await handler.LoadImageAsync(source);
|
||||
|
||||
ValidateTestBitmap(uiImage, alpha);
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task PixmapToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var pixmap = bitmap.PeekPixels();
|
||||
|
||||
var source = (SKPixmapImageSource)pixmap;
|
||||
|
||||
using var uiImage = await handler.LoadImageAsync(source);
|
||||
|
||||
ValidateTestBitmap(uiImage, alpha);
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(0)]
|
||||
[InlineData(10)]
|
||||
[InlineData(100)]
|
||||
[InlineData(255)]
|
||||
public async Task EncodedDataBackedImageToBitmap(byte alpha)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap(alpha);
|
||||
using var data = bitmap.Encode(SKEncodedImageFormat.Png, 100);
|
||||
using var image = SKImage.FromEncodedData(data);
|
||||
|
||||
var source = (SKImageImageSource)image;
|
||||
|
||||
using var uiImage = await handler.LoadImageAsync(source);
|
||||
|
||||
ValidateTestBitmap(uiImage, alpha);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,88 +19,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void GRPixelConfigMappingsToSKColorType()
|
||||
{
|
||||
var obsolete = new[] {
|
||||
GRPixelConfig.Sbgra8888,
|
||||
GRPixelConfig.RgbaFloat,
|
||||
GRPixelConfig.RgFloat,
|
||||
};
|
||||
|
||||
foreach (GRPixelConfig value in Enum.GetValues(typeof(GRPixelConfig)))
|
||||
{
|
||||
var colortype = value switch
|
||||
{
|
||||
GRPixelConfig.Unknown => SKColorType.Unknown,
|
||||
GRPixelConfig.Alpha8 => SKColorType.Alpha8,
|
||||
GRPixelConfig.Gray8 => SKColorType.Gray8,
|
||||
GRPixelConfig.Rgb565 => SKColorType.Rgb565,
|
||||
GRPixelConfig.Rgba4444 => SKColorType.Argb4444,
|
||||
GRPixelConfig.Rgba8888 => SKColorType.Rgba8888,
|
||||
GRPixelConfig.Rgb888 => SKColorType.Rgb888x,
|
||||
GRPixelConfig.Bgra8888 => SKColorType.Bgra8888,
|
||||
GRPixelConfig.Srgba8888 => SKColorType.Rgba8888,
|
||||
GRPixelConfig.Rgba1010102 => SKColorType.Rgba1010102,
|
||||
GRPixelConfig.AlphaHalf => SKColorType.AlphaF16,
|
||||
GRPixelConfig.RgbaHalf => SKColorType.RgbaF16,
|
||||
GRPixelConfig.Alpha8AsAlpha => SKColorType.Alpha8,
|
||||
GRPixelConfig.Alpha8AsRed => SKColorType.Alpha8,
|
||||
GRPixelConfig.AlphaHalfAsLum => SKColorType.AlphaF16,
|
||||
GRPixelConfig.AlphaHalfAsRed => SKColorType.AlphaF16,
|
||||
GRPixelConfig.Gray8AsLum => SKColorType.Gray8,
|
||||
GRPixelConfig.Gray8AsRed => SKColorType.Gray8,
|
||||
GRPixelConfig.RgbaHalfClamped => SKColorType.RgbaF16Clamped,
|
||||
GRPixelConfig.Alpha16 => SKColorType.Alpha16,
|
||||
GRPixelConfig.Rg1616 => SKColorType.Rg1616,
|
||||
GRPixelConfig.Rgba16161616 => SKColorType.Rgba16161616,
|
||||
GRPixelConfig.RgHalf => SKColorType.RgF16,
|
||||
GRPixelConfig.Rg88 => SKColorType.Rg88,
|
||||
GRPixelConfig.Rgb888x => SKColorType.Rgb888x,
|
||||
GRPixelConfig.RgbEtc1 => SKColorType.Rgb888x,
|
||||
_ => SKColorType.Unknown,
|
||||
};
|
||||
|
||||
if (Array.IndexOf(obsolete, value) != -1)
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => value.ToColorType());
|
||||
else
|
||||
Assert.Equal(colortype, value.ToColorType());
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void GRPixelConfigMappingsFromSKColorType()
|
||||
{
|
||||
foreach (SKColorType value in Enum.GetValues(typeof(SKColorType)))
|
||||
{
|
||||
var config = value switch
|
||||
{
|
||||
SKColorType.Unknown => GRPixelConfig.Unknown,
|
||||
SKColorType.Alpha8 => GRPixelConfig.Alpha8,
|
||||
SKColorType.Gray8 => GRPixelConfig.Gray8,
|
||||
SKColorType.Rgb565 => GRPixelConfig.Rgb565,
|
||||
SKColorType.Argb4444 => GRPixelConfig.Rgba4444,
|
||||
SKColorType.Rgba8888 => GRPixelConfig.Rgba8888,
|
||||
SKColorType.Rgb888x => GRPixelConfig.Rgb888,
|
||||
SKColorType.Bgra8888 => GRPixelConfig.Bgra8888,
|
||||
SKColorType.Rgba1010102 => GRPixelConfig.Rgba1010102,
|
||||
SKColorType.AlphaF16 => GRPixelConfig.AlphaHalf,
|
||||
SKColorType.RgbaF16 => GRPixelConfig.RgbaHalf,
|
||||
SKColorType.RgbaF16Clamped => GRPixelConfig.RgbaHalfClamped,
|
||||
SKColorType.Alpha16 => GRPixelConfig.Alpha16,
|
||||
SKColorType.Rg1616 => GRPixelConfig.Rg1616,
|
||||
SKColorType.Rgba16161616 => GRPixelConfig.Rgba16161616,
|
||||
SKColorType.RgF16 => GRPixelConfig.RgHalf,
|
||||
SKColorType.Rg88 => GRPixelConfig.Rg88,
|
||||
_ => GRPixelConfig.Unknown,
|
||||
};
|
||||
|
||||
Assert.Equal(config, value.ToPixelConfig());
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void SKColorTypeMappingsToNative()
|
||||
{
|
||||
|
|
|
@ -49,21 +49,20 @@ namespace SkiaSharp.Tests
|
|||
Assert.NotNull(grContext);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void ToGlSizedFormat()
|
||||
{
|
||||
var obsolete = new[] {
|
||||
GRPixelConfig.Sbgra8888,
|
||||
GRPixelConfig.RgbaFloat,
|
||||
GRPixelConfig.RgFloat,
|
||||
var unknowns = new[] {
|
||||
SKColorType.Unknown,
|
||||
SKColorType.Rgb101010x,
|
||||
SKColorType.RgbaF32,
|
||||
SKColorType.Bgra1010102,
|
||||
SKColorType.Bgr101010x
|
||||
};
|
||||
|
||||
foreach (GRPixelConfig value in Enum.GetValues(typeof(GRPixelConfig)))
|
||||
foreach (SKColorType value in Enum.GetValues(typeof(SKColorType)))
|
||||
{
|
||||
if (Array.IndexOf(obsolete, value) != -1)
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => value.ToGlSizedFormat());
|
||||
else if (value == GRPixelConfig.Unknown)
|
||||
if (Array.IndexOf(unknowns, value) != -1)
|
||||
Assert.Equal(0u, value.ToGlSizedFormat());
|
||||
else
|
||||
Assert.NotEqual(0u, value.ToGlSizedFormat());
|
||||
|
|
|
@ -377,9 +377,11 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void BitmapResizesObsolete()
|
||||
[SkippableTheory]
|
||||
[InlineData(SKFilterQuality.Low)]
|
||||
[InlineData(SKFilterQuality.Medium)]
|
||||
[InlineData(SKFilterQuality.High)]
|
||||
public void BitmapResizes(SKFilterQuality quality)
|
||||
{
|
||||
var srcInfo = new SKImageInfo(200, 200);
|
||||
var dstInfo = new SKImageInfo(100, 100);
|
||||
|
@ -396,32 +398,7 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal(SKColors.Green, srcBmp.GetPixel(75, 75));
|
||||
Assert.Equal(SKColors.Blue, srcBmp.GetPixel(175, 175));
|
||||
|
||||
var dstBmp = srcBmp.Resize(dstInfo, SKBitmapResizeMethod.Mitchell);
|
||||
Assert.NotNull(dstBmp);
|
||||
|
||||
Assert.Equal(SKColors.Green, dstBmp.GetPixel(25, 25));
|
||||
Assert.Equal(SKColors.Blue, dstBmp.GetPixel(75, 75));
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void BitmapResizes()
|
||||
{
|
||||
var srcInfo = new SKImageInfo(200, 200);
|
||||
var dstInfo = new SKImageInfo(100, 100);
|
||||
|
||||
var srcBmp = new SKBitmap(srcInfo);
|
||||
|
||||
using (var canvas = new SKCanvas(srcBmp))
|
||||
using (var paint = new SKPaint { Color = SKColors.Green })
|
||||
{
|
||||
canvas.Clear(SKColors.Blue);
|
||||
canvas.DrawRect(new SKRect(0, 0, 100, 200), paint);
|
||||
}
|
||||
|
||||
Assert.Equal(SKColors.Green, srcBmp.GetPixel(75, 75));
|
||||
Assert.Equal(SKColors.Blue, srcBmp.GetPixel(175, 175));
|
||||
|
||||
var dstBmp = srcBmp.Resize(dstInfo, SKFilterQuality.High);
|
||||
var dstBmp = srcBmp.Resize(dstInfo, quality);
|
||||
Assert.NotNull(dstBmp);
|
||||
|
||||
Assert.Equal(SKColors.Green, dstBmp.GetPixel(25, 25));
|
||||
|
|
|
@ -72,7 +72,8 @@ namespace SkiaSharp.Tests
|
|||
canvas.Clear(SKColors.White);
|
||||
using (var builder = new SKTextBlobBuilder())
|
||||
{
|
||||
builder.AddRun(paint, 0, 0, glyphs);
|
||||
var run = builder.AllocateRun(paint.GetFont(), glyphs.Length, 0, 0);
|
||||
run.SetGlyphs(glyphs);
|
||||
canvas.DrawText(builder.Build(), 150, 175, paint);
|
||||
}
|
||||
|
||||
|
@ -188,30 +189,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void CanDrawNullPointerZeroLengthText()
|
||||
{
|
||||
using (var bmp = new SKBitmap(new SKImageInfo(300, 300)))
|
||||
using (var canvas = new SKCanvas(bmp))
|
||||
using (var paint = new SKPaint())
|
||||
{
|
||||
canvas.DrawText(IntPtr.Zero, 0, 150, 175, paint);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void ThrowsOnDrawNullPointerText()
|
||||
{
|
||||
using (var bmp = new SKBitmap(new SKImageInfo(300, 300)))
|
||||
using (var canvas = new SKCanvas(bmp))
|
||||
using (var paint = new SKPaint())
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => canvas.DrawText(IntPtr.Zero, 123, 150, 175, paint));
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void CanvasCanClipRoundRect()
|
||||
{
|
||||
|
@ -432,49 +409,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void SvgCanvasSavesFileUsingWriter()
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
|
||||
using (var wstream = new SKManagedWStream(stream))
|
||||
using (var writer = new SKXmlStreamWriter(wstream))
|
||||
using (var svg = SKSvgCanvas.Create(SKRect.Create(100, 100), writer))
|
||||
{
|
||||
var paint = new SKPaint
|
||||
{
|
||||
Color = SKColors.Red,
|
||||
Style = SKPaintStyle.Fill
|
||||
};
|
||||
svg.DrawRect(SKRect.Create(10, 10, 80, 80), paint);
|
||||
}
|
||||
|
||||
stream.Position = 0;
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
var xml = reader.ReadToEnd();
|
||||
var xdoc = XDocument.Parse(xml);
|
||||
|
||||
var svg = xdoc.Root;
|
||||
var ns = svg.Name.Namespace;
|
||||
|
||||
Assert.Equal(ns + "svg", svg.Name);
|
||||
Assert.Equal("100", svg.Attribute("width")?.Value);
|
||||
Assert.Equal("100", svg.Attribute("height")?.Value);
|
||||
|
||||
var rect = svg.Element(ns + "rect");
|
||||
Assert.Equal(ns + "rect", rect.Name);
|
||||
Assert.Equal("red", rect.Attribute("fill")?.Value);
|
||||
Assert.Null(rect.Attribute("stroke")?.Value);
|
||||
Assert.Equal("10", rect.Attribute("x")?.Value);
|
||||
Assert.Equal("10", rect.Attribute("y")?.Value);
|
||||
Assert.Equal("80", rect.Attribute("width")?.Value);
|
||||
Assert.Equal("80", rect.Attribute("height")?.Value);
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(SKTextAlign.Left, 300)]
|
||||
[InlineData(SKTextAlign.Center, 162)]
|
||||
|
@ -524,7 +458,8 @@ namespace SkiaSharp.Tests
|
|||
|
||||
var glyphs = paint.GetGlyphs("SkiaSharp");
|
||||
using var blobBuilder = new SKTextBlobBuilder();
|
||||
blobBuilder.AddRun(paint, 0, 0, glyphs);
|
||||
var run = blobBuilder.AllocateRun(paint.GetFont(), glyphs.Length, 0, 0);
|
||||
run.SetGlyphs(glyphs);
|
||||
using var blob = blobBuilder.Build();
|
||||
|
||||
canvas.DrawText(blob, 300, 100, paint);
|
||||
|
@ -562,7 +497,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
using var blobBuilder = new SKTextBlobBuilder();
|
||||
var run = blobBuilder.AllocateHorizontalRun(paint, glyphs.Length, 0);
|
||||
var run = blobBuilder.AllocateHorizontalRun(paint.GetFont(), glyphs.Length, 0);
|
||||
run.SetGlyphs(glyphs);
|
||||
run.SetPositions(positions);
|
||||
using var blob = blobBuilder.Build();
|
||||
|
@ -602,7 +537,7 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
using var blobBuilder = new SKTextBlobBuilder();
|
||||
var run = blobBuilder.AllocatePositionedRun(paint, glyphs.Length);
|
||||
var run = blobBuilder.AllocatePositionedRun(paint.GetFont(), glyphs.Length);
|
||||
run.SetGlyphs(glyphs);
|
||||
run.SetPositions(positions);
|
||||
using var blob = blobBuilder.Build();
|
||||
|
@ -642,10 +577,11 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
|
||||
using var blobBuilder = new SKTextBlobBuilder();
|
||||
var run = blobBuilder.AllocatePositionedRun(paint, glyphs.Length);
|
||||
var run = blobBuilder.AllocatePositionedRun(paint.GetFont(), glyphs.Length);
|
||||
run.SetGlyphs(glyphs);
|
||||
run.SetPositions(positions);
|
||||
blobBuilder.AddRun(paint, 0, 100, glyphs);
|
||||
var run2 = blobBuilder.AllocateRun(paint.GetFont(), glyphs.Length, 0, 100);
|
||||
run2.SetGlyphs(glyphs);
|
||||
using var blob = blobBuilder.Build();
|
||||
|
||||
canvas.DrawText(blob, 300, 100, paint);
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace SkiaSharp.Tests
|
|||
[SkippableFact]
|
||||
public void NamedGamutIsCorrect()
|
||||
{
|
||||
var csxyz = SKColorSpaceXyz.Dcip3;
|
||||
var csxyz = SKColorSpaceXyz.DisplayP3;
|
||||
|
||||
var values = new float[] {
|
||||
0.515102f, 0.291965f, 0.157153f,
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace SkiaSharp.Tests
|
|||
{
|
||||
var colorspace = SKColorSpace.CreateRgb(
|
||||
new SKColorSpaceTransferFn { A = 0.6f, B = 0.5f, C = 0.4f, D = 0.3f, E = 0.2f, F = 0.1f },
|
||||
SKMatrix44.CreateIdentity());
|
||||
SKColorSpaceXyz.Identity);
|
||||
|
||||
Assert.NotNull(colorspace);
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace SkiaSharp.Tests
|
|||
{
|
||||
var colorspace = SKColorSpace.CreateRgb(
|
||||
new SKColorSpaceTransferFn { A = 0.1f, B = 0.2f, C = 0.3f, D = 0.4f, E = 0.5f, F = 0.6f },
|
||||
SKMatrix44.CreateIdentity());
|
||||
SKColorSpaceXyz.Identity);
|
||||
var handle = colorspace.Handle;
|
||||
Assert.Equal(1, handle.GetReferenceCount(false));
|
||||
|
||||
|
@ -182,7 +182,7 @@ namespace SkiaSharp.Tests
|
|||
{
|
||||
var colorspace = SKColorSpace.CreateRgb(
|
||||
new SKColorSpaceTransferFn { A = 0.1f, B = 0.2f, C = 0.3f, D = 0.4f, E = 0.5f, F = 0.6f },
|
||||
SKMatrix44.CreateIdentity());
|
||||
SKColorSpaceXyz.Identity);
|
||||
|
||||
Assert.NotNull(colorspace);
|
||||
|
||||
|
@ -203,15 +203,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void SrgbColorsSpaceIsNamedSrgb()
|
||||
{
|
||||
var colorspace = SKColorSpace.CreateSrgb();
|
||||
|
||||
Assert.Equal(SKNamedGamma.Srgb, colorspace.NamedGamma);
|
||||
Assert.Equal(SKColorSpaceType.Rgb, colorspace.Type);
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void AdobeRGB1998IsRGB()
|
||||
{
|
||||
|
@ -220,8 +211,6 @@ namespace SkiaSharp.Tests
|
|||
var colorspace = SKColorSpace.CreateIcc(File.ReadAllBytes(icc));
|
||||
|
||||
Assert.Equal(SKColorSpaceXyz.AdobeRgb, colorspace.ToColorSpaceXyz());
|
||||
Assert.Equal(SKNamedGamma.TwoDotTwoCurve, colorspace.NamedGamma);
|
||||
Assert.Equal(SKColorSpaceType.Rgb, colorspace.Type);
|
||||
|
||||
var fnValues = new[] { 2.2f, 1f, 0f, 0f, 0f, 0f, 0f };
|
||||
Assert.True(colorspace.GetNumericalTransferFunction(out var fn));
|
||||
|
@ -234,40 +223,8 @@ namespace SkiaSharp.Tests
|
|||
0.01947f, 0.06087f, 0.74457f, 0f,
|
||||
0f, 0f, 0f, 1f,
|
||||
};
|
||||
AssertMatrix(toXYZ, colorspace.ToXyzD50());
|
||||
|
||||
var matrix = new SKMatrix44();
|
||||
Assert.True(colorspace.ToXyzD50(matrix));
|
||||
AssertMatrix(toXYZ, matrix);
|
||||
|
||||
Assert.True(colorspace.ToColorSpaceXyz(out var xyz));
|
||||
AssertMatrix(toXYZ, xyz.ToMatrix44());
|
||||
|
||||
var fromXYZ = new[]
|
||||
{
|
||||
1.96253f, -0.61068f, -0.34137f, 0f,
|
||||
-0.97876f, 1.91615f, 0.03342f, 0f,
|
||||
0.02869f, -0.14067f, 1.34926f, 0f,
|
||||
0f, 0f, 0f, 1f,
|
||||
};
|
||||
AssertMatrix(fromXYZ, colorspace.FromXyzD50());
|
||||
}
|
||||
|
||||
[SkippableFact(Skip = "CMYK is not supported.")]
|
||||
public void USWebCoatedSWOPIsCMYK()
|
||||
{
|
||||
var icc = Path.Combine(PathToImages, "USWebCoatedSWOP.icc");
|
||||
|
||||
var colorspace = SKColorSpace.CreateIcc(File.ReadAllBytes(icc));
|
||||
|
||||
Assert.Equal(SKNamedGamma.NonStandard, colorspace.NamedGamma);
|
||||
Assert.Equal(SKColorSpaceType.Cmyk, colorspace.Type);
|
||||
|
||||
var fnValues = new[] { 0f, 0f, 0f, 0f, 0f, 0f, 0f };
|
||||
Assert.False(colorspace.GetNumericalTransferFunction(out var fn));
|
||||
Assert.Equal(fnValues, fn.Values);
|
||||
|
||||
Assert.Null(colorspace.ToXyzD50());
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
|
@ -343,7 +300,7 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal("SkiaSharp.SKColorSpace+SKColorSpaceStatic", colorspace1.GetType().FullName);
|
||||
Assert.Equal(2, colorspace1.GetReferenceCount());
|
||||
|
||||
var colorspace2 = SKColorSpace.CreateRgb(SKNamedGamma.Linear, SKColorSpaceGamut.Srgb);
|
||||
var colorspace2 = SKColorSpace.CreateRgb(SKColorSpaceTransferFn.Linear, SKColorSpaceXyz.Srgb);
|
||||
Assert.Equal("SkiaSharp.SKColorSpace+SKColorSpaceStatic", colorspace2.GetType().FullName);
|
||||
Assert.Equal(2, colorspace2.GetReferenceCount());
|
||||
|
||||
|
@ -351,7 +308,7 @@ namespace SkiaSharp.Tests
|
|||
|
||||
var colorspace3 = SKColorSpace.CreateRgb(
|
||||
new SKColorSpaceTransferFn { A = 0.6f, B = 0.5f, C = 0.4f, D = 0.3f, E = 0.2f, F = 0.1f },
|
||||
SKMatrix44.CreateIdentity());
|
||||
SKColorSpaceXyz.Identity);
|
||||
Assert.NotSame(colorspace1, colorspace3);
|
||||
|
||||
colorspace3.Dispose();
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xunit;
|
||||
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
public class SKColorTableTest : SKTest
|
||||
{
|
||||
private readonly static SKColor[] Colors = new SKColor[]
|
||||
{
|
||||
(SKColor)0x33008200,
|
||||
SKColors.Black,
|
||||
SKColors.White,
|
||||
SKColors.Red,
|
||||
SKColors.Green,
|
||||
SKColors.Blue
|
||||
};
|
||||
|
||||
private readonly static SKPMColor[] PMColors = new SKPMColor[]
|
||||
{
|
||||
(SKPMColor)(SKColor)0x33008200,
|
||||
(SKPMColor)SKColors.Black,
|
||||
(SKPMColor)SKColors.White,
|
||||
(SKPMColor)SKColors.Red,
|
||||
(SKPMColor)SKColors.Green,
|
||||
(SKPMColor)SKColors.Blue
|
||||
};
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void MembersRetrieveSingleColorWithAlpha()
|
||||
{
|
||||
var c = (SKColor)0x33008200;
|
||||
var pm = SKPMColor.PreMultiply(c);
|
||||
var upm = SKPMColor.UnPreMultiply(pm);
|
||||
|
||||
Assert.Equal(new SKColor(0x33008200), c);
|
||||
Assert.Equal(new SKPMColor(0x33001A00), pm);
|
||||
Assert.Equal(new SKColor(0x33008200), upm);
|
||||
|
||||
var ctContents = new[] { pm };
|
||||
var ct = new SKColorTable(ctContents, 1);
|
||||
|
||||
Assert.Equal(1, ct.Count);
|
||||
|
||||
Assert.Equal(new SKPMColor(0x33001A00), ct[0]);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void MembersRetrieveColors()
|
||||
{
|
||||
var colorTable = new SKColorTable(Colors);
|
||||
|
||||
Assert.Equal(Colors.Length, colorTable.Count);
|
||||
|
||||
Assert.Equal(PMColors, colorTable.Colors);
|
||||
Assert.Equal(Colors, colorTable.UnPreMultipledColors);
|
||||
|
||||
Assert.Equal(PMColors[0], colorTable[0]);
|
||||
Assert.Equal(PMColors[1], colorTable[1]);
|
||||
Assert.Equal(PMColors[2], colorTable[2]);
|
||||
Assert.Equal(PMColors[3], colorTable[3]);
|
||||
Assert.Equal(PMColors[4], colorTable[4]);
|
||||
Assert.Equal(PMColors[5], colorTable[5]);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void IndexerOutOfRangeBelow()
|
||||
{
|
||||
var colorTable = new SKColorTable(Colors);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var color = colorTable[-1];
|
||||
});
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void IndexerOutOfRangeAbove()
|
||||
{
|
||||
var colorTable = new SKColorTable(Colors);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
{
|
||||
var color = colorTable[250];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -876,74 +876,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void EncodeWithSimpleSerializer()
|
||||
{
|
||||
var bitmap = CreateTestBitmap();
|
||||
|
||||
bool encoded = false;
|
||||
var serializer = SKPixelSerializer.Create(pixmap =>
|
||||
{
|
||||
encoded = true;
|
||||
return pixmap.Encode(SKEncodedImageFormat.Jpeg, 100);
|
||||
});
|
||||
|
||||
var image = SKImage.FromBitmap(bitmap);
|
||||
var data = image.Encode(serializer);
|
||||
|
||||
var codec = SKCodec.Create(data);
|
||||
|
||||
Assert.Equal(SKEncodedImageFormat.Jpeg, codec.EncodedFormat);
|
||||
|
||||
Assert.True(encoded);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void EncodeWithSerializer()
|
||||
{
|
||||
var bitmap = CreateTestBitmap();
|
||||
|
||||
var serializer = new TestSerializer();
|
||||
|
||||
var image = SKImage.FromBitmap(bitmap);
|
||||
var data = image.Encode(serializer);
|
||||
|
||||
Assert.NotNull(data);
|
||||
|
||||
Assert.Equal(1, serializer.DidEncode);
|
||||
Assert.Equal(0, serializer.DidUseEncodedData);
|
||||
|
||||
Assert.Equal(data.ToArray(), bitmap.Bytes);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
private class TestSerializer : SKPixelSerializer
|
||||
{
|
||||
public int DidEncode { get; set; }
|
||||
|
||||
public int DidUseEncodedData { get; set; }
|
||||
|
||||
public SKImageInfo EncodedInfo { get; set; }
|
||||
|
||||
protected override SKData OnEncode(SKPixmap pixmap)
|
||||
{
|
||||
DidEncode++;
|
||||
|
||||
EncodedInfo = pixmap.Info;
|
||||
|
||||
return SKData.CreateCopy(pixmap.GetPixels(), (ulong)pixmap.Info.BytesSize);
|
||||
}
|
||||
|
||||
protected override bool OnUseEncodedData(IntPtr data, IntPtr length)
|
||||
{
|
||||
DidUseEncodedData++;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData("osm-liberty.png", 30, 240, 0xFF725A50)]
|
||||
[InlineData("testimage.png", 1040, 340, 0xFF0059FF)]
|
||||
|
|
|
@ -238,20 +238,5 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal((double)10, (double)newPoint.X, PRECISION);
|
||||
Assert.Equal((double)40, (double)newPoint.Y, PRECISION);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void SetScaleTranslateWorksCorrectly()
|
||||
{
|
||||
var tempMatrix = SKMatrix.MakeIdentity();
|
||||
|
||||
tempMatrix.Values = new float[] { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
|
||||
|
||||
SKMatrix.RotateDegrees(ref tempMatrix, 0);
|
||||
|
||||
tempMatrix.SetScaleTranslate(1.2f, 1.0f, 0, 0);
|
||||
|
||||
Assert.Equal(1.2f, tempMatrix.Values[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,92 +24,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
private void DrawGpuTextureWithDesc(Action<SKSurface, GRGlBackendTextureDesc> draw)
|
||||
{
|
||||
using (var ctx = CreateGlContext())
|
||||
{
|
||||
ctx.MakeCurrent();
|
||||
|
||||
// create the texture
|
||||
var textureInfo = ctx.CreateTexture(new SKSizeI(100, 100));
|
||||
// this is a new field that was added to the struct
|
||||
textureInfo.Format = 0;
|
||||
var textureDesc = new GRGlBackendTextureDesc
|
||||
{
|
||||
Width = 100,
|
||||
Height = 100,
|
||||
Config = GRPixelConfig.Rgba8888,
|
||||
Flags = GRBackendTextureDescFlags.RenderTarget,
|
||||
Origin = GRSurfaceOrigin.BottomLeft,
|
||||
SampleCount = 0,
|
||||
TextureHandle = textureInfo,
|
||||
};
|
||||
|
||||
// create the surface
|
||||
using (var grContext = GRContext.CreateGl())
|
||||
using (var surface = SKSurface.CreateAsRenderTarget(grContext, textureDesc))
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
||||
draw(surface, textureDesc);
|
||||
}
|
||||
|
||||
// clean up
|
||||
ctx.DestroyTexture(textureInfo.Id);
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GRTextureInfoOld
|
||||
{
|
||||
public uint Target;
|
||||
public uint Id;
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
private void DrawGpuTextureWithOldDesc(Action<SKSurface, GRBackendTextureDesc> draw)
|
||||
{
|
||||
using (var ctx = CreateGlContext())
|
||||
{
|
||||
ctx.MakeCurrent();
|
||||
|
||||
// create the texture
|
||||
var textureInfo = ctx.CreateTexture(new SKSizeI(100, 100));
|
||||
|
||||
var oldInfo = new GRTextureInfoOld
|
||||
{
|
||||
Id = textureInfo.Id,
|
||||
Target = textureInfo.Target
|
||||
};
|
||||
var textureHandle = GCHandle.Alloc(oldInfo, GCHandleType.Pinned);
|
||||
var textureDesc = new GRBackendTextureDesc
|
||||
{
|
||||
Width = 100,
|
||||
Height = 100,
|
||||
Config = GRPixelConfig.Rgba8888,
|
||||
Flags = GRBackendTextureDescFlags.RenderTarget,
|
||||
Origin = GRSurfaceOrigin.BottomLeft,
|
||||
SampleCount = 0,
|
||||
TextureHandle = textureHandle.AddrOfPinnedObject(),
|
||||
};
|
||||
|
||||
// create the surface
|
||||
using (var grContext = GRContext.CreateGl())
|
||||
using (var surface = SKSurface.CreateAsRenderTarget(grContext, textureDesc))
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
||||
draw(surface, textureDesc);
|
||||
}
|
||||
|
||||
// clean up
|
||||
textureHandle.Free();
|
||||
ctx.DestroyTexture(textureInfo.Id);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGpuTexture(Action<SKSurface, GRBackendTexture> draw)
|
||||
{
|
||||
using (var ctx = CreateGlContext())
|
||||
|
@ -122,7 +36,7 @@ namespace SkiaSharp.Tests
|
|||
|
||||
// create the surface
|
||||
using (var grContext = GRContext.CreateGl())
|
||||
using (var surface = SKSurface.CreateAsRenderTarget(grContext, texture, SKColorType.Rgba8888))
|
||||
using (var surface = SKSurface.Create(grContext, texture, SKColorType.Rgba8888))
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
||||
|
@ -256,11 +170,7 @@ namespace SkiaSharp.Tests
|
|||
public void SimpleSurfaceWithPropsIsCorrect()
|
||||
{
|
||||
var info = new SKImageInfo(100, 100);
|
||||
var props = new SKSurfaceProps
|
||||
{
|
||||
Flags = SKSurfacePropsFlags.UseDeviceIndependentFonts,
|
||||
PixelGeometry = SKPixelGeometry.RgbVertical
|
||||
};
|
||||
var props = new SKSurfaceProperties(SKSurfacePropsFlags.UseDeviceIndependentFonts, SKPixelGeometry.RgbVertical);
|
||||
using (var surface = SKSurface.Create(info, props))
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
@ -270,9 +180,6 @@ namespace SkiaSharp.Tests
|
|||
|
||||
Assert.Equal(props.PixelGeometry, surface.SurfaceProperties.PixelGeometry);
|
||||
Assert.Equal(props.Flags, surface.SurfaceProperties.Flags);
|
||||
|
||||
Assert.Equal(props.PixelGeometry, surface.SurfaceProps.PixelGeometry);
|
||||
Assert.Equal(props.Flags, surface.SurfaceProps.Flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -328,91 +235,6 @@ namespace SkiaSharp.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void CanConvertFromPointerToDescToTextureWithNewInfo()
|
||||
{
|
||||
// the custom struct to contain the info
|
||||
var oldInfo = new GRGlTextureInfo
|
||||
{
|
||||
Id = 123,
|
||||
Target = 456,
|
||||
Format = 789
|
||||
};
|
||||
|
||||
// pin it for the native code
|
||||
var textureHandle = GCHandle.Alloc(oldInfo, GCHandleType.Pinned);
|
||||
|
||||
// use the very old desc
|
||||
var textureDesc = new GRBackendTextureDesc
|
||||
{
|
||||
Width = 100,
|
||||
Height = 100,
|
||||
Config = GRPixelConfig.Rgba8888,
|
||||
Flags = GRBackendTextureDescFlags.RenderTarget,
|
||||
Origin = GRSurfaceOrigin.BottomLeft,
|
||||
SampleCount = 246,
|
||||
TextureHandle = textureHandle.AddrOfPinnedObject(),
|
||||
};
|
||||
|
||||
// create the new texture
|
||||
var texture = new GRBackendTexture(textureDesc);
|
||||
|
||||
// free up all resourcess
|
||||
textureHandle.Free();
|
||||
|
||||
// make sure we kept the information
|
||||
Assert.Equal(100, texture.Width);
|
||||
Assert.Equal(100, texture.Height);
|
||||
var newInfo = texture.GetGlTextureInfo();
|
||||
Assert.Equal(oldInfo.Id, newInfo.Id);
|
||||
Assert.Equal(oldInfo.Target, newInfo.Target);
|
||||
Assert.Equal(GRPixelConfig.Rgba8888.ToGlSizedFormat(), newInfo.Format);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void CanConvertFromPointerToDescToTexture()
|
||||
{
|
||||
// the custom struct to contain the info
|
||||
var oldInfo = new GRTextureInfoOld
|
||||
{
|
||||
Id = 123,
|
||||
Target = 456
|
||||
};
|
||||
|
||||
// pin it for the native code
|
||||
var textureHandle = GCHandle.Alloc(oldInfo, GCHandleType.Pinned);
|
||||
|
||||
// use the very old desc
|
||||
var textureDesc = new GRBackendTextureDesc
|
||||
{
|
||||
Width = 100,
|
||||
Height = 100,
|
||||
Config = GRPixelConfig.Rgba8888,
|
||||
Flags = GRBackendTextureDescFlags.RenderTarget,
|
||||
Origin = GRSurfaceOrigin.BottomLeft,
|
||||
SampleCount = 246,
|
||||
TextureHandle = textureHandle.AddrOfPinnedObject(),
|
||||
};
|
||||
|
||||
// create the new texture
|
||||
var texture = new GRBackendTexture(textureDesc);
|
||||
|
||||
// free up all resourcess
|
||||
textureHandle.Free();
|
||||
|
||||
// make sure we kept the information
|
||||
Assert.Equal(100, texture.Width);
|
||||
Assert.Equal(100, texture.Height);
|
||||
var newInfo = texture.GetGlTextureInfo();
|
||||
Assert.Equal(oldInfo.Id, newInfo.Id);
|
||||
Assert.Equal(oldInfo.Target, newInfo.Target);
|
||||
Assert.Equal(GRPixelConfig.Rgba8888.ToGlSizedFormat(), newInfo.Format);
|
||||
}
|
||||
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuBackendSurfaceIsCreated()
|
||||
|
@ -428,97 +250,6 @@ namespace SkiaSharp.Tests
|
|||
});
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceIsCreatedWithDesc()
|
||||
{
|
||||
DrawGpuTextureWithDesc((surface, desc) =>
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
||||
var canvas = surface.Canvas;
|
||||
Assert.NotNull(canvas);
|
||||
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
});
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceCanBeReadWithDesc()
|
||||
{
|
||||
DrawGpuTextureWithDesc((surface, desc) =>
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
canvas.Clear(SKColors.Red);
|
||||
canvas.Flush();
|
||||
|
||||
using (var image = surface.Snapshot())
|
||||
{
|
||||
Assert.True(image.IsTextureBacked);
|
||||
|
||||
using (var raster = image.ToRasterImage())
|
||||
{
|
||||
Assert.False(raster.IsTextureBacked);
|
||||
Assert.NotSame(image, raster);
|
||||
|
||||
using (var bmp = SKBitmap.FromImage(raster))
|
||||
{
|
||||
Assert.Equal(SKColors.Red, bmp.GetPixel(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceIsCreatedWithOldDesc()
|
||||
{
|
||||
DrawGpuTextureWithOldDesc((surface, desc) =>
|
||||
{
|
||||
Assert.NotNull(surface);
|
||||
|
||||
var canvas = surface.Canvas;
|
||||
Assert.NotNull(canvas);
|
||||
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
});
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceCanBeReadWithOldDesc()
|
||||
{
|
||||
DrawGpuTextureWithOldDesc((surface, desc) =>
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
canvas.Clear(SKColors.Red);
|
||||
canvas.Flush();
|
||||
|
||||
using (var image = surface.Snapshot())
|
||||
{
|
||||
Assert.True(image.IsTextureBacked);
|
||||
|
||||
using (var raster = image.ToRasterImage())
|
||||
{
|
||||
Assert.False(raster.IsTextureBacked);
|
||||
|
||||
using (var bmp = SKBitmap.FromImage(raster))
|
||||
{
|
||||
Assert.Equal(SKColors.Red, bmp.GetPixel(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.Gpu)]
|
||||
[SkippableFact]
|
||||
public void GpuTextureSurfaceIsCreated()
|
||||
|
|
|
@ -16,24 +16,6 @@ namespace SkiaSharp.Tests
|
|||
Assert.Null(blob);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public void NonGlyphTextEncodingDoesNotThrow()
|
||||
{
|
||||
using var paint = new SKPaint { TextEncoding = SKTextEncoding.Utf16 };
|
||||
|
||||
using var builder = new SKTextBlobBuilder();
|
||||
|
||||
var run = builder.AllocateRun(paint, 100, 0, 0, 50);
|
||||
Assert.Equal(100, run.GetGlyphSpan().Length);
|
||||
Assert.Equal(50, run.GetTextSpan().Length);
|
||||
|
||||
using var blob = builder.Build();
|
||||
Assert.NotNull(blob);
|
||||
|
||||
Assert.Equal(SKTextEncoding.Utf16, paint.TextEncoding);
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void TestExplicitBounds()
|
||||
{
|
||||
|
@ -48,21 +30,21 @@ namespace SkiaSharp.Tests
|
|||
|
||||
{
|
||||
var r1 = SKRect.Create(10, 10, 20, 20);
|
||||
builder.AllocateRun(font, 16, 0, 0, 0, r1);
|
||||
builder.AllocateRun(font.GetFont(), 16, 0, 0, r1);
|
||||
var blob = builder.Build();
|
||||
Assert.Equal(r1, blob.Bounds);
|
||||
}
|
||||
|
||||
{
|
||||
var r1 = SKRect.Create(10, 10, 20, 20);
|
||||
builder.AllocateHorizontalRun(font, 16, 0, 0, r1);
|
||||
builder.AllocateHorizontalRun(font.GetFont(), 16, 0, r1);
|
||||
var blob = builder.Build();
|
||||
Assert.Equal(r1, blob.Bounds);
|
||||
}
|
||||
|
||||
{
|
||||
var r1 = SKRect.Create(10, 10, 20, 20);
|
||||
builder.AllocatePositionedRun(font, 16, 0, r1);
|
||||
builder.AllocatePositionedRun(font.GetFont(), 16, r1);
|
||||
var blob = builder.Build();
|
||||
Assert.Equal(r1, blob.Bounds);
|
||||
}
|
||||
|
@ -72,9 +54,9 @@ namespace SkiaSharp.Tests
|
|||
var r2 = SKRect.Create(15, 20, 50, 50);
|
||||
var r3 = SKRect.Create(0, 5, 10, 5);
|
||||
|
||||
builder.AllocateRun(font, 16, 0, 0, 0, r1);
|
||||
builder.AllocateHorizontalRun(font, 16, 0, 0, r2);
|
||||
builder.AllocatePositionedRun(font, 16, 0, r3);
|
||||
builder.AllocateRun(font.GetFont(), 16, 0, 0, r1);
|
||||
builder.AllocateHorizontalRun(font.GetFont(), 16, 0, r2);
|
||||
builder.AllocatePositionedRun(font.GetFont(), 16, r3);
|
||||
|
||||
var blob = builder.Build();
|
||||
Assert.Equal(SKRect.Create(0, 5, 65, 65), blob.Bounds);
|
||||
|
@ -98,7 +80,7 @@ namespace SkiaSharp.Tests
|
|||
var glyphs = font.GetGlyphs(txt);
|
||||
|
||||
font.TextEncoding = SKTextEncoding.GlyphId;
|
||||
builder.AddPositionedRun(font, glyphs, new SKPoint[glyphs.Length]);
|
||||
builder.AddPositionedRun(glyphs, font.GetFont(), new SKPoint[glyphs.Length]);
|
||||
|
||||
var blob = builder.Build();
|
||||
Assert.True(blob.Bounds.IsEmpty);
|
||||
|
@ -111,7 +93,7 @@ namespace SkiaSharp.Tests
|
|||
font.TextEncoding = SKTextEncoding.GlyphId;
|
||||
|
||||
var builder = new SKTextBlobBuilder();
|
||||
var run = builder.AllocatePositionedRun(font, 3);
|
||||
var run = builder.AllocatePositionedRun(font.GetFont(), 3);
|
||||
|
||||
var positions = new[] { new SKPoint(1, 2), new SKPoint(3, 4), new SKPoint(5, 6) };
|
||||
var positionsRaw = new float[] { 1, 2, 3, 4, 5, 6 };
|
||||
|
|
|
@ -241,23 +241,6 @@ namespace SkiaSharp.Tests
|
|||
Assert.DoesNotContain((ushort)0, glyphs);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
[Trait(Traits.Category.Key, Traits.Category.Values.MatchCharacter)]
|
||||
[SkippableFact]
|
||||
public void UnicodeGlyphsReturnsTheCorrectNumberOfCharactersObsolete()
|
||||
{
|
||||
const string text = "🚀";
|
||||
var emojiChar = StringUtilities.GetUnicodeCharacterCode(text, SKTextEncoding.Utf32);
|
||||
|
||||
var typeface = SKFontManager.Default.MatchCharacter(emojiChar);
|
||||
Assert.NotNull(typeface);
|
||||
|
||||
Assert.True(typeface.CountGlyphs(text) > 0);
|
||||
Assert.True(typeface.CountGlyphs(text, SKEncoding.Utf32) > 0);
|
||||
Assert.True(typeface.GetGlyphs(text).Length > 0);
|
||||
Assert.True(typeface.GetGlyphs(text, SKEncoding.Utf32).Length > 0);
|
||||
}
|
||||
|
||||
[Trait(Traits.SkipOn.Key, Traits.SkipOn.Values.macOS)] // macOS does not release the data when the typeface is disposed
|
||||
[SkippableFact]
|
||||
public unsafe void ReleaseDataWasInvokedOnlyAfterTheTypefaceWasFinished()
|
||||
|
@ -499,22 +482,6 @@ namespace SkiaSharp.Tests
|
|||
Assert.NotSame(tf1, tf2);
|
||||
}
|
||||
|
||||
[Trait(Traits.SkipOn.Key, Traits.SkipOn.Values.iOS)] // macOS does not support matching typefaces
|
||||
[Trait(Traits.SkipOn.Key, Traits.SkipOn.Values.macOS)] // macOS does not support matching typefaces
|
||||
[Trait(Traits.SkipOn.Key, Traits.SkipOn.Values.MacCatalyst)] // macOS does not support matching typefaces
|
||||
[Obsolete]
|
||||
[SkippableFact]
|
||||
public unsafe void FromTypefaceReturnsSameObject()
|
||||
{
|
||||
var tf = SKTypeface.FromFamilyName(DefaultFontFamily);
|
||||
|
||||
var tf1 = SKTypeface.FromTypeface(tf, SKTypefaceStyle.Normal);
|
||||
var tf2 = SKTypeface.FromTypeface(tf, SKTypefaceStyle.Normal);
|
||||
|
||||
Assert.Same(tf, tf1);
|
||||
Assert.Same(tf1, tf2);
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public unsafe void FromFamilyReturnsSameObject()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче