public static bool IsValid3DColorCube(SKData cubeData, int cubeDimension) { var minMemorySize = 4 * cubeDimension * cubeDimension * cubeDimension; return (cubeDimension >= MinColorCubeDimension) && (cubeDimension <= MaxColorCubeDimension) && (null != cubeData) && (cubeData.Size >= minMemorySize); }
public static SKImage FromData (SKData data) { if (data == null) throw new ArgumentNullException (nameof (data)); var handle = SkiaApi.sk_image_new_from_encoded (data.Handle, IntPtr.Zero); return GetObject<SKImage> (handle); }
public static SKColorFilter CreateColorCube(SKData cubeData, int cubeDimension) { if (cubeData == null) throw new ArgumentNullException(nameof(cubeData)); if (!IsValid3DColorCube(cubeData, cubeDimension)) throw new ArgumentException("Invalid cube data.", nameof(cubeData)); return GetObject<SKColorFilter>(SkiaApi.sk_colorfilter_new_color_cube(cubeData.Handle, cubeDimension)); }
public static SKImage FromData(SKData data, SKRectI subset) { if (data == null) throw new ArgumentNullException ("data"); var handle = SkiaApi.sk_image_new_from_encoded (data.Handle, ref subset); return GetObject<SKImage> (handle); }
public static SKBitmap Decode(SKData data, SKImageInfo bitmapInfo) { if (data == null) { throw new ArgumentNullException(nameof(data)); } using (var codec = SKCodec.Create(data)) { if (codec == null) { return(null); } return(Decode(codec, bitmapInfo)); } }
public static SKImage FromEncodedData(byte[] data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (data.Length == 0) { throw new ArgumentException("The data buffer was empty."); } using (var skdata = SKData.CreateCopy(data)) { return(FromEncodedData(skdata)); } }
public static SKBitmap Decode(byte[] buffer, SKImageInfo bitmapInfo) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } fixed(byte *b = buffer) { using (var skdata = SKData.Create((IntPtr)b, buffer.Length)) using (var codec = SKCodec.Create(skdata)) { return(Decode(codec, bitmapInfo)); } } }
public static SKImageInfo DecodeBounds(byte[] buffer) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } fixed(byte *b = buffer) { using (var skdata = SKData.Create((IntPtr)b, buffer.Length)) using (var codec = SKCodec.Create(skdata)) { return(codec?.Info ?? SKImageInfo.Empty); } } }
public static SKImage FromEncodedData(string filename) { if (filename == null) { throw new ArgumentNullException(nameof(filename)); } using (var skdata = SKData.Create(filename)) { if (skdata == null) { return(null); } return(FromEncodedData(skdata)); } }
public static SKImage FromData(SKData data) { if (data == null) { throw new ArgumentNullException("data"); } var handle = SkiaApi.sk_image_new_from_encoded(data.Handle, IntPtr.Zero); if (handle == IntPtr.Zero) { return(null); } return(new SKImage(handle)); }
public static SKImage FromEncodedData(ReadOnlySpan <byte> data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (data.Length == 0) { throw new ArgumentException("The data buffer was empty."); fixed(byte *b = data) { using (var skdata = SKData.Create((IntPtr)b, data.Length)) { return(FromEncodedData(skdata)); } } }
public static SKImage FromData(SKData data) { return(FromEncodedData(data)); }
public static SKImage FromData(SKData data, SKRectI subset) { return(FromEncodedData(data, subset)); }
// Serialize public SKData Serialize() => SKData.GetObject(SkiaApi.sk_picture_serialize_to_data(Handle));
public MyUnmanagedMemoryStream(SKData host) : base((byte *)host.Data, host.Size) { this.host = host; }
public static SKBitmap Decode(SKData data) { using (var codec = SKCodec.Create(data)) { return(Decode(codec)); } }
public static SKCodec Create (SKData data) { if (data == null) throw new ArgumentNullException (nameof (data)); return GetObject<SKCodec> (SkiaApi.sk_codec_new_from_data (data.Handle)); }
public SKMemoryStream (SKData data) : this(SkiaApi.sk_memorystream_new_with_skdata (data), true) { if (Handle == IntPtr.Zero) { throw new InvalidOperationException ("Unable to create a new SKMemoryStream instance."); } }
public static SKImageInfo DecodeBounds (SKData data) { if (data == null) { throw new ArgumentNullException (nameof (data)); } using (var codec = SKCodec.Create (data)) { return codec.Info; } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposeHost) { host?.Dispose(); } host = null; }
// create (data) public static SKCodec Create(SKData data) { if (data == null) throw new ArgumentNullException(nameof(data)); }
public SKMemoryStream(SKData data) : this(SkiaApi.sk_memorystream_new_with_skdata(data)) { }
public SKData DetachAsData() { return(SKData.GetObject(SkiaApi.sk_dynamicmemorywstream_detach_as_data(Handle))); }
public extern static sk_stream_memorystream_t sk_memorystream_new_with_skdata(SKData data);
public static SKTypeface FromData(SKData data, int index = 0) { return(SKTypeface.FromStream(new SKMemoryStream(data), index)); }
public unsafe SKDataStream(SKData host, bool disposeHost = false) : base((byte*)host.Data, host.Size) { this.host = host; this.disposeHost = disposeHost; }
internal static SKData FromCString(string str) { var bytes = Encoding.ASCII.GetBytes(str ?? string.Empty); return(SKData.CreateCopy(bytes, (ulong)(bytes.Length + 1))); // + 1 for the terminating char }
public void DrawAnnotation(SKRect rect, string key, SKData value) { SkiaApi.sk_canvas_draw_annotation(Handle, ref rect, Util.GetEncodedText(key, SKTextEncoding.Utf8), value == null ? IntPtr.Zero : value.Handle); }
public static SKBitmap Decode (SKData data, SKImageInfo bitmapInfo) { if (data == null) { throw new ArgumentNullException (nameof (data)); } using (var codec = SKCodec.Create (data)) { return Decode (codec, bitmapInfo); } }
public void DrawNamedDestinationAnnotation(SKPoint point, SKData value) { SkiaApi.sk_canvas_draw_named_destination_annotation(Handle, ref point, value == null ? IntPtr.Zero : value.Handle); }
public static SKImage FromPixels(SKImageInfo info, SKData data) => FromPixels(info, data, info.RowBytes);
private SKColorFilter ToColorFilter(SKData uniforms) => ToColorFilter(uniforms, null);
static SKData() { empty = new SKDataStatic(SkiaApi.sk_data_new_empty()); }
public SKData Encode() => SKData.GetObject(SkiaApi.sk_image_encode(Handle));
public unsafe SKDataStream(SKData host, bool disposeHost = false) : base((byte *)host.Data, host.Size) { this.host = host; this.disposeHost = disposeHost; }
public SKData Encode(SKEncodedImageFormat format, int quality) { return(SKData.GetObject(SkiaApi.sk_image_encode_specific(Handle, format, quality))); }
public void DrawUrlAnnotation(SKRect rect, SKData value) { SkiaApi.sk_canvas_draw_url_annotation(Handle, ref rect, value == null ? IntPtr.Zero : value.Handle); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); host = null; }
public void DrawLinkDestinationAnnotation(SKRect rect, SKData value) { SkiaApi.sk_canvas_draw_link_destination_annotation(Handle, ref rect, value == null ? IntPtr.Zero : value.Handle); }
public static SKImageInfo DecodeBounds(SKData data) { using (var codec = SKCodec.Create(data)) { return(codec.Info); } }