Skip to content

Creating a new Image<TPixel> by Wrapping IMemoryOwner<byte> #1580

Answered by antonfirsov
ptasev asked this question in Ideas
Discussion options

You must be logged in to vote

This would be essentially a convenience extension accompanying an existing IMemoryOwner<TPixel> method:

public static Image<TPixel> WrapMemory<TPixel>(
Configuration configuration,
IMemoryOwner<TPixel> pixelMemoryOwner,
int width,
int height,
ImageMetadata metadata)
where TPixel : unmanaged, IPixel<TPixel>
{

Since Memory<byte> overloads already exist, it makes sense to also have IMemoryOwner<byte> overloads for API symmetry. The easiest implementation would be to create a WrapperMemoryOwner<TPixel> that adapts IMemoryOwner<byte>. Interested in PR-ing it?

/cc @Serg…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Sergio0694
Comment options

@ptasev
Comment options

ptasev Mar 23, 2021
Author Sponsor

Answer selected by ptasev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants