Open xtuzy opened 2 years ago
Are you saying this was different in earlier versions?
no difference compare with 2.88.0, i just feel it is not right, stream should be disposed by user like this
using(var stream = ***)
{
var bitmap = SKBitmap.Decode(stream);
}
@xtuzy
Just use SKData
to wrap the stream
, the stream
will not be closed after SKBitmap.Decode
.
using(var stream = ***)
{
var skData = SKData.Create(stream);
var bitmap = SKBitmap.Decode(skData);
//stream will not be closed here
}
This is a really bad design choice if not a bug.
I'll need to confirm, but I am pretty sure this is expected. The decode usually reads all the way to the end, and the stream may not always be rewindable. So there was not much point in keeping it open... However, the Stream overloads could maybe get an additional parameter to indicate whether or not to close the stream.
@mattleibow Managing a Stream should be left up to the user, not a completely different function they call.
I use SKBitmap.Decode(stream) to create a Bitmap, when i need continue use this stream, i found it is dispose.
Skiasharp Version: 2.88.2