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
AdvancedImageExtensions.GetPixelSpan is now obsolete, and there is no convenient way to get a single pixel span for memory interop use-cases
Keeping the pixel span methods in AdvancedImageExtensions leads to poor discoverability. With all the Roslyn analyzers we have today, to detect Span<T> misuse, I no longer consider them unsafe or "advanced". I suggest to make them instance members on Image<TPixel> and ImageFrame<TPixel>. Note: this does not apply for Memory<T> or IMemoryGroup<T> stuff, since persisting heap-references to the pixel memory has some nontrivial consequences.
Problems
We have two, somewhat related issues to address:
AdvancedImageExtensions.GetPixelSpan
is now obsolete, and there is no convenient way to get a single pixel span for memory interop use-casesAdvancedImageExtensions
leads to poor discoverability. With all the Roslyn analyzers we have today, to detectSpan<T>
misuse, I no longer consider them unsafe or "advanced". I suggest to make them instance members onImage<TPixel>
andImageFrame<TPixel>
. Note: this does not apply forMemory<T>
orIMemoryGroup<T>
stuff, since persisting heap-references to the pixel memory has some nontrivial consequences.Proposal
Redifine
Span<TPixel>
methods as following:Update: Fixed copy/paste errors in the proposal.
The text was updated successfully, but these errors were encountered: