Investigate integration with Microsoft.Toolkit.HighPerformance #1392
-
Hey @JimBobSquarePants and team, wanted to run an idea by you guys 😄
I'm fully aware that I was wondering, would this be something you might be interested in if it came with no extra package dependencies, for instance via a git submodule that directly points to the source of the two packages in the Toolkit repo (here)? I'd be more than happy to help out with the integration and with some refactoring in Other examplesWas going through some bits of code in I was these conversion methods from internal static unsafe Image<TPixel> From24bppRgbSystemDrawingBitmap2<TPixel>(Bitmap bmp)
where TPixel : unmanaged, IPixel<TPixel>
{
int w = bmp.Width;
int h = bmp.Height;
var fullRect = new Rectangle(0, 0, w, h);
BitmapData data = bmp.LockBits(fullRect, ImageLockMode.ReadWrite, bmp.PixelFormat);
try
{
var image = new Image<TPixel>(w, h);
Configuration configuration = image.GetConfiguration();
Span2D<Bgr24> source = new Span2D<Bgr24>((void*)data.Scan0, h, w, 0);
for (int y = 0; y < h; y++)
{
PixelOperations<TPixel>.Instance.FromBgr24(configuration, source.GetRowSpan(y), image.GetPixelRowSpan(y));
}
return image;
}
finally
{
bmp.UnlockBits(data);
}
} You can see how the Let me know what you think! 🚀 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
You probably won't like my answer. We have our own versions of Regarding In short, I'd see such an experiment a distraction from our top goals, with little or no benefits. Our time is super limited these days, and we need it to be 100% focused on our backlog: |
Beta Was this translation helpful? Give feedback.
You probably won't like my answer.
We have our own versions of
Memory2D
(Buffer2D
) andSpan2D
(Buffer2DRegion
) which are already integrated, and work efficiently with other ImageSharp memory management primitives. In theory we could unify these middleware components, which would be an interesting technical challenge, but doesn't bring visible customer benefits for ImageSharp.Regarding
Guard
,ThrowHelper
and similar: I believe these are very thin primitives, where a potential benefit of a dependency doesn't justify the cost of taking a dependency. I believe we get the most productivity and flexibility if the source of these primitives is self-contained & maintained by SixLabors.In short,…