Skip to content

Image<Rgba32>.GetPixelSpan() from 1.0.0-beta0007 to 2.1.2 #2130

Answered by avengerx
avengerx asked this question in Ideas
Discussion options

You must be logged in to vote

For now it seems re-implementing it works via this extension method in my project:

public static Span<T> GetPixelSpan<T>(this Image<T> imageRef) where T : unmanaged, IPixel<T>
{
    var memoryFootprint = new T[imageRef.Width * imageRef.Height];
    var pixelSpan = new Span<T>(memoryFootprint);
    imageRef.CopyPixelDataTo(pixelSpan);
    return pixelSpan;
}

Looking forward to everyone's insight on this matter. And if that's adequate an approach, I hope this helps everyone else facing this issue.

Replies: 1 comment 2 replies

Comment options

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

@avengerx
Comment options

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