public static SKImage FromEncodedData(SKStream data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } using (var codec = SKCodec.Create(data)) { if (codec == null) { return(null); } var bitmap = SKBitmap.Decode(codec, codec.Info); if (bitmap == null) { return(null); } bitmap.SetImmutable(); return(FromPixels(bitmap.PeekPixels(), delegate { bitmap.Dispose(); bitmap = null; })); } }
public static SKImageInfo DecodeBounds(Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } return(DecodeBounds(SKStream.WrapManagedStream(stream))); }
public static SKBitmap Decode(Stream stream, SKImageInfo bitmapInfo) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } return(Decode(SKStream.WrapManagedStream(stream), bitmapInfo)); }
public bool WriteStream(SKStream input, int length) { if (input == null) { throw new ArgumentNullException(nameof(input)); } return(SkiaApi.sk_wstream_write_stream(Handle, input.Handle, (IntPtr)length)); }
public static SKImageInfo DecodeBounds (SKStream stream) { if (stream == null) { throw new ArgumentNullException (nameof (stream)); } using (var codec = SKCodec.Create (stream)) { return codec?.Info ?? SKImageInfo.Empty; } }
public static SKData Create(SKStream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } return(Create(stream, stream.Length)); }
public static SKData Create(SKStream stream, long length) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } return(GetObject(SkiaApi.sk_data_new_from_stream(stream.Handle, (IntPtr)length))); }
public static SKData Create(Stream stream, long length) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } return(Create(SKStream.WrapManagedStream(stream), length)); }
public static SKBitmap Decode(SKStream stream, SKImageInfo bitmapInfo) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } using (var codec = SKCodec.Create(stream)) { return(Decode(codec, bitmapInfo)); } }
protected override void DisposeManaged() { if (disposeStream && stream != null) { stream.Dispose(); stream = null; } base.DisposeManaged(); }
public static SKImage FromPixelCopy(SKImageInfo info, SKStream pixels, int rowBytes) { if (pixels == null) { throw new ArgumentNullException(nameof(pixels)); } using (var data = SKData.Create(pixels)) { return(FromPixelData(info, data, rowBytes)); } }
public static SKCodec Create(SKStream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } var codec = GetObject <SKCodec> (SkiaApi.sk_codec_new_from_stream(stream.Handle)); stream.RevokeOwnership(codec); return(codec); }
public static SKBitmap Decode (SKStream stream) { if (stream == null) { throw new ArgumentNullException (nameof (stream)); } using (var codec = SKCodec.Create (stream)) { if (codec == null) { return null; } return Decode (codec); } }
protected override void Dispose(bool disposing) { if (disposing) { if (disposeStream && stream != null) { stream.Dispose(); stream = null; } } base.Dispose(disposing); }
public static SKCodec Create(SKStream stream, out SKCodecResult result) { if (stream == null) throw new ArgumentNullException(nameof(stream)); fixed(SKCodecResult *r = &result) { var codec = GetObject(SkiaApi.sk_codec_new_from_stream(stream.Handle, r)); stream.RevokeOwnership(codec); return(codec); } }
public SKFrontBufferedManagedStream(SKStream nativeStream, int bufferSize, bool disposeUnderlyingStream) { var length = nativeStream.HasLength ? nativeStream.Length : 0; var position = nativeStream.HasPosition ? nativeStream.Position : 0; disposeStream = disposeUnderlyingStream; stream = nativeStream; hasLength = nativeStream.HasPosition && nativeStream.HasLength; streamLength = length - position; offset = 0; bufferedSoFar = 0; bufferLength = bufferSize; frontBuffer = new byte[bufferSize]; }
public static SKImage FromEncodedData(SKStream data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } using (var codec = SKCodec.Create(data)) using (var bitmap = SKBitmap.Decode(codec, codec.Info)) { if (bitmap == null) { return(null); } return(FromBitmap(bitmap)); } }
public static SKImage FromEncodedData(SKStream data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } using (var skdata = SKData.Create(data)) { if (skdata == null) { return(null); } return(FromEncodedData(skdata)); } }
public static SKCodec Create(SKStream stream, out SKCodecResult result) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (stream is SKFileStream filestream && !filestream.IsValid) throw new ArgumentException("File stream was not valid.", nameof(stream)); fixed(SKCodecResult *r = &result) { var codec = GetObject(SkiaApi.sk_codec_new_from_stream(stream.Handle, r)); stream.RevokeOwnership(codec); return(codec); } }
public static SKPicture Deserialize(SKStream stream) { if (stream == null) throw new ArgumentNullException(nameof(stream)); }
public static SKCodec Create (SKStream stream) { if (stream == null) throw new ArgumentNullException (nameof (stream)); var codec = GetObject<SKCodec> (SkiaApi.sk_codec_new_from_stream (stream.Handle)); stream.RevokeOwnership (codec); return codec; }
public bool WriteStream (SKStream input, int length) { if (input == null) { throw new ArgumentNullException (nameof(input)); } return SkiaApi.sk_wstream_write_stream (Handle, input.Handle, (IntPtr)length); }
// create a new image from a copy of pixel data public static SKImage FromPixelCopy(SKImageInfo info, SKStream pixels) => FromPixelCopy(info, pixels, info.RowBytes);
public SKFrontBufferedManagedStream(SKStream nativeStream, int bufferSize) : this(nativeStream, bufferSize, false) { }
public static SKImageInfo DecodeBounds(SKStream stream) { using (var codec = SKCodec.Create(stream)) { return(codec.Info); } }
public static SKBitmap Decode(SKStream stream) { using (var codec = SKCodec.Create(stream)) { return(Decode(codec)); } }
// create a new image from a copy of pixel data public static SKImage FromPixelCopy(SKImageInfo info, SKStream pixels) { return(FromPixelCopy(info, pixels, info.RowBytes)); }
public static SKBitmap Decode (SKStream stream, SKImageInfo bitmapInfo) { if (stream == null) { throw new ArgumentNullException (nameof (stream)); } using (var codec = SKCodec.Create (stream)) { return Decode (codec, bitmapInfo); } }
public static SKImageInfo DecodeBounds (SKStream stream) { if (stream == null) { throw new ArgumentNullException (nameof (stream)); } using (var codec = SKCodec.Create (stream)) { return codec.Info; } }
public SKImageDecoderResult Decode(SKStream stream, SKBitmap bitmap, SKColorType pref = SKColorType.Unknown, SKImageDecoderMode mode = SKImageDecoderMode.DecodePixels) { return(SkiaApi.sk_imagedecoder_decode(Handle, stream.Handle, bitmap.Handle, pref, mode)); }
public static SKCodec Create(SKStream stream) { return(Create(stream, out var result)); }
public static SKCodec Create(SKStream stream) => Create(stream, out var result);