|
|
|
@ -16,16 +16,22 @@ namespace SixLabors.ImageSharp |
|
|
|
public abstract partial class Image |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -53,16 +59,22 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -80,16 +92,22 @@ namespace SixLabors.ImageSharp |
|
|
|
=> WrapMemory(configuration, pixelMemory, width, height, new ImageMetadata()); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type.</typeparam>
|
|
|
|
/// <param name="pixelMemory">The pixel memory.</param>
|
|
|
|
@ -177,16 +195,22 @@ namespace SixLabors.ImageSharp |
|
|
|
=> WrapMemory(Configuration.Default, pixelMemoryOwner, width, height); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -217,16 +241,22 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -244,16 +274,22 @@ namespace SixLabors.ImageSharp |
|
|
|
=> WrapMemory<TPixel>(configuration, byteMemory, width, height, new ImageMetadata()); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// The ownership of the underlying buffer for the input <see cref="Memory{T}"/> instance is not being transferred to
|
|
|
|
/// the new <see cref="Image{TPixel}"/> instance, meaning that consumers of this method need to make sure the input buffer
|
|
|
|
/// is either self-contianed (for instance, this is the case for a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is not disposed.
|
|
|
|
/// For instance, if the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: using this method does not transfer the ownership of the underlying buffer of the input <see cref="Memory{T}"/>
|
|
|
|
/// to the new <see cref="Image{TPixel}"/> instance. This means that consumers of this method must ensure that the input buffer
|
|
|
|
/// is either self-contained, (for example, a <see cref="Memory{T}"/> instance wrapping a new array that was
|
|
|
|
/// created), or that the owning object is not disposed until the returned <see cref="Image{TPixel}"/> is disposed.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// If the input <see cref="Memory{T}"/> instance is one retrieved from an <see cref="IMemoryOwner{T}"/> instance
|
|
|
|
/// rented from a memory pool (such as <see cref="MemoryPool{T}"/>), and that owning instance is disposed while the image is still
|
|
|
|
/// in use, this will lead to undefined behavior and possibly runtime crashes (as the same buffer might then be modified by other
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers properly.
|
|
|
|
/// consumers while the returned image is still working on it). Make sure to control the lifetime of the input buffers appropriately.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type.</typeparam>
|
|
|
|
/// <param name="byteMemory">The byte memory representing the pixel data.</param>
|
|
|
|
@ -268,21 +304,27 @@ namespace SixLabors.ImageSharp |
|
|
|
=> WrapMemory<TPixel>(Configuration.Default, byteMemory, width, height); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// This method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer, and it requires that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For instance, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers need to ensure that that memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: this method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer and that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For example, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers must ensure that the memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// in use and not disposed. The same applies if the input memory area points to a pinned managed object, as callers
|
|
|
|
/// need to ensure that object will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// must ensure that objects will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// Failing to do so constitutes undefined behavior and will likely lead to memory corruption and runtime crashes.
|
|
|
|
/// Note that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Note also that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// either <see cref="byte"/> or <typeparamref name="TPixel"/> values, it is highly recommended to use one of the other
|
|
|
|
/// available overloads of this method instead (such as <see cref="WrapMemory{TPixel}(Configuration, Memory{byte}, int, int)"/>
|
|
|
|
/// or <see cref="WrapMemory{TPixel}(Configuration, Memory{TPixel}, int, int)"/>, to make the resulting code less error
|
|
|
|
/// prone and avoid having to pin the underlying memory buffer in use. This method is primarily meant to be used when
|
|
|
|
/// doing interop or working with buffers that are located in unmanaged memory.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -312,21 +354,27 @@ namespace SixLabors.ImageSharp |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// This method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer, and it requires that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For instance, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers need to ensure that that memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: this method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer and that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For example, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers must ensure that the memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// in use and not disposed. The same applies if the input memory area points to a pinned managed object, as callers
|
|
|
|
/// need to ensure that object will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// must ensure that objects will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// Failing to do so constitutes undefined behavior and will likely lead to memory corruption and runtime crashes.
|
|
|
|
/// Note that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Note also that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// either <see cref="byte"/> or <typeparamref name="TPixel"/> values, it is highly recommended to use one of the other
|
|
|
|
/// available overloads of this method instead (such as <see cref="WrapMemory{TPixel}(Configuration, Memory{byte}, int, int)"/>
|
|
|
|
/// or <see cref="WrapMemory{TPixel}(Configuration, Memory{TPixel}, int, int)"/>, to make the resulting code less error
|
|
|
|
/// prone and avoid having to pin the underlying memory buffer in use. This method is primarily meant to be used when
|
|
|
|
/// doing interop or working with buffers that are located in unmanaged memory.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type</typeparam>
|
|
|
|
/// <param name="configuration">The <see cref="Configuration"/></param>
|
|
|
|
@ -344,21 +392,27 @@ namespace SixLabors.ImageSharp |
|
|
|
=> WrapMemory<TPixel>(configuration, pointer, width, height, new ImageMetadata()); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels,
|
|
|
|
/// allowing to view/manipulate it as an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// This method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer, and it requires that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For instance, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers need to ensure that that memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// <para>
|
|
|
|
/// Wraps an existing contiguous memory area of 'width' x 'height' pixels allowing viewing/manipulation as
|
|
|
|
/// an <see cref="Image{TPixel}"/> instance.
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Please note: this method relies on callers to carefully manage the target memory area being referenced by the
|
|
|
|
/// pointer and that the lifetime of such a memory area is at least equal to that of the returned
|
|
|
|
/// <see cref="Image{TPixel}"/> instance. For example, if the input pointer references an unmanaged memory area,
|
|
|
|
/// callers must ensure that the memory area is not freed as long as the returned <see cref="Image{TPixel}"/> is
|
|
|
|
/// in use and not disposed. The same applies if the input memory area points to a pinned managed object, as callers
|
|
|
|
/// need to ensure that object will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// must ensure that objects will remain pinned as long as the <see cref="Image{TPixel}"/> instance is in use.
|
|
|
|
/// Failing to do so constitutes undefined behavior and will likely lead to memory corruption and runtime crashes.
|
|
|
|
/// Note that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// </para>
|
|
|
|
/// <para>
|
|
|
|
/// Note also that if you have a <see cref="Memory{T}"/> or an array (which can be cast to <see cref="Memory{T}"/>) of
|
|
|
|
/// either <see cref="byte"/> or <typeparamref name="TPixel"/> values, it is highly recommended to use one of the other
|
|
|
|
/// available overloads of this method instead (such as <see cref="WrapMemory{TPixel}(Configuration, Memory{byte}, int, int)"/>
|
|
|
|
/// or <see cref="WrapMemory{TPixel}(Configuration, Memory{TPixel}, int, int)"/>, to make the resulting code less error
|
|
|
|
/// prone and avoid having to pin the underlying memory buffer in use. This method is primarily meant to be used when
|
|
|
|
/// doing interop or working with buffers that are located in unmanaged memory.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TPixel">The pixel type.</typeparam>
|
|
|
|
/// <param name="pointer">The pointer to the target memory buffer to wrap.</param>
|
|
|
|
|