You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
byte[]buffer;using(varimage=newHeifImage("MyImage.heic"))using(varprimary=image.PrimaryImage()){buffer=primary.ToArray();}// do something with buffer
Usage - AsStream
Streamstream;using(varimage=newHeifimage("MyImage.heic"))using(varprimary=image.PrimaryImage()){stream=primary.AsStream();}// do something with stream// don't forget to dispose of your streamstream?.Dispose();
Usage - AsReadOnlySpan
This one is a little tricky as Span<T> gives us access to native memory. If we allow C# to operate on native memory we should ensure it happens within the IDisposable using block otherwise there will be a memory leak.
ReadOnlySpan<byte>span;using(varimage=newHeifImage("MyImage.heic"))using(varprimary=image.PrimaryImage()){ReadOnlySpan<byte>span=primary.AsReadOnlySpan();// do something with span}
The text was updated successfully, but these errors were encountered:
Description
Add memory buffer APIs that can return an array or a stream
New APIs
Usage - ToArray()
Usage - AsStream
Usage - AsReadOnlySpan
This one is a little tricky as
Span<T>
gives us access to native memory. If we allow C# to operate on native memory we should ensure it happens within theIDisposable
using block otherwise there will be a memory leak.The text was updated successfully, but these errors were encountered: