我正在尝试缩小在Winforms中显示的大型图像(〜23k x 1k)。我正在缩放图像的当前方式的时间太长,这就是为什么我想通过SharpDX(C#)使用GPU来提高性能的原因。做这个的好方法是什么?
我正在努力通过应用比例效果来扩展图像的方法(我现在无法访问),但是我仍然不完全理解SharpDx,所以我想知道是否有更好的方法去这个。 I modeled my code off of
是否有更快地使用SharpDX缩放图像的方法,或者是我当前方法的最快方法?
I'm trying to scale down large images (~ 23k x 1k) to be displayed in winforms. The current way I'm scaling the images is taking too long, which is why I want to use the GPU through SharpDX (C#) to improve performance. What would be a good way to do this?
I'm working on a method to scale an image by applying the scale effect (that I don't have access to right now), but I still don't fully understand SharpDX, so I'm wondering if there's a better way to go about this. I modeled my code off of this example but I removed the text overlay, the image saving, the drawing portion, and I replaced the gaussian with the scaling effect. Since I'm using GDI to do the drawing for simplicity, the image is in the form of a systems drawing bitmap so I initialize the encoder with a memory stream that I use to get the output image after the scaling effect is applied. The smaller tests I have done with this method don't seem to make the scaling much quicker, but I haven't been able to put this fully in action yet.
Is there a quicker way to scale down an image using SharpDX, or is something along the lines of my current method the quickest?
发布评论
评论(1)
基于我在
看起来像SharpDx大约是GDI或更好的两倍。
在我的Windows 11计算机上使用的测试代码。即使您知道像我一样了解SharpDx,也应该足以让您开始。
我根据该页面上的样本制作的类。
使用的库是SharpDx + .Direct2d1 + .Direct3d11 + .dxgi 4.2。
Based on what I found on https://csharp.hotexamples.com/examples/SharpDX.WIC/WICStream/-/php-wicstream-class-examples.html
Looks like SharpDX about twice the performance of GDI or better.
Test code that works on my Windows 11 computer. Should be enough to get you started even if you know as little of SharpDX as I do.
Class I made based on the samples found on that page.
Library used was SharpDX + .Direct2D1 + .Direct3D11 + .DXGI 4.2.