开发者

Is there a way to do hardware accelerated per-pixel or pixel shader operations on an image (using Drawing.Image) in C#?

开发者_如何学JAVAThe goal is to do hardware accelerated brightness, contrast, or RGB color adjustments to an image. Using C# and storing the result in a Drawing.Image.

I've tried using matrix transforms but they're not hardware accelerated. And using XAML is hardware accelerated but when extracting the image the conversion from Media.Image to a standard .NET Drawing.Image changes the image contents (using Microsoft's conversion methods); i.e. the converted output does not match the input.

I'm assuming there's a way to use DirectX/pixel shaders from C# and operate on or, at least, write to a Drawing.Image.

Thanks


You should check out CUDA if you have an NVIDIA GPU.


Have you looked at XNA? The Texture2D object can load from memorystream or from a bitmap file and you can either get the data out of the texture as an array or save it to a file. This should have the majority of the code you would actually need to write:

http://msdn.microsoft.com/en-us/library/bb313868(v=xnagamestudio.31).aspx

but there are lots of xna tutorial for doing pixel shaders if you need more examples... like this one (http://blog.josack.com/2011/07/my-first-2d-pixel-shaders-part-1.html)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜