问题描述:

The 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)

相关阅读:
Top