SKData Class

Definition

The SKData holds an immutable data buffer.

public class SKData : SkiaSharp.SKObject
Inheritance

Remarks

Not only is the data immutable, but the actual pointer that is returned by the Data property is guaranteed to always be the same for the life of this instance.

The AsStream() method can be used to return a Stream that wraps this SKData and allows for .NET APIs to scan the contents of the SKData as a stream.

Properties

Data

Gets a pointer to the data wrapped by this SKData.

Empty

Gets a reference to the empty data instance.

Handle

Gets or sets the handle to the underlying native object.

(Inherited from SKObject)
IgnorePublicDispose

Gets or sets a value indicating whether the call the public Dispose() should be no-op.

(Inherited from SKNativeObject)
IsDisposed

Gets or sets a value indicating whether the object has already been disposed.

(Inherited from SKNativeObject)
IsEmpty

Gets a value indicating whether or not the data is empty.

OwnsHandle

Gets a value indicating whether this object should destroy the underlying native object.

(Inherited from SKObject)
Size

Gets the size of this data object in bytes.

Span

Methods

AsSpan()

Returns a span that wraps the underlying data.

AsStream()

Wraps the SKData as a Stream.

AsStream(Boolean)

Wraps the SKData as a Stream.

Create(Int32)

Returns a new SKData instance with uninitialized data.

Create(Int64)
Create(IntPtr, Int32)

Returns a new SKData instance with reference to the specified data.

Create(IntPtr, Int32, SKDataReleaseDelegate)

Returns a new SKData instance with reference to the specified data.

Create(IntPtr, Int32, SKDataReleaseDelegate, Object)

Returns a new SKData instance with reference to the specified data.

Create(SKStream)

Returns a new SKData instance with a copy of the data from the stream.

Create(SKStream, Int32)

Returns a new SKData instance with a copy of the data from the stream.

Create(SKStream, Int64)

Returns a new SKData instance with a copy of the data from the stream.

Create(SKStream, UInt64)

Returns a new SKData instance with a copy of the data from the stream.

Create(Stream)

Returns a new SKData instance with a copy of the data from the stream.

Create(Stream, Int32)

Returns a new SKData instance with a copy of the data from the stream.

Create(Stream, Int64)

Returns a new SKData instance with a copy of the data from the stream.

Create(Stream, UInt64)

Returns a new SKData instance with a copy of the data from the stream.

Create(String)

Returns a new SKData instance with the data from the file.

Create(UInt64)

Returns a new SKData instance with uninitialized data.

CreateCopy(Byte[])

Returns a new SKData instance with a copy of the provided byte array.

CreateCopy(Byte[], UInt64)

Returns a new SKData instance with a copy of the provided byte array.

CreateCopy(IntPtr, Int32)
CreateCopy(IntPtr, Int64)
CreateCopy(IntPtr, UInt64)

Returns a new SKData instance with a copy of the provided byte buffer.

CreateCopy(ReadOnlySpan<Byte>)

Returns a new SKData instance with a copy of the provided byte span.

Dispose()

Releases all resources used by this SKNativeObject.

(Inherited from SKNativeObject)
Dispose(Boolean)

Releases the resources associated with the data. If this SKData was created with one of the SkiaSharp.SKData.FromMallocMemory(System.IntPtr,System.UInt64) methods, then the operating system's "free" method will be called on the data.

DisposeInternal()

Triggers a dispose, ignoring the value of IgnorePublicDispose.

(Inherited from SKNativeObject)
DisposeManaged()

Implemented by derived SKObject types to destroy any managed objects.

(Inherited from SKObject)
DisposeNative()

Implemented by derived SKObject types to destroy any native objects.

(Inherited from SKObject)
DisposeUnownedManaged() (Inherited from SKObject)
SaveTo(Stream)

Saves the buffer into the provided stream.

Subset(UInt64, UInt64)

Creates a new SKData that points to a slice in this SKData.

ToArray()

Copies the data object into a byte array.

Applies to