views:

301

answers:

1

hi there,

i'm currently experimenting using PixelShaders introduced with .net 3.5 sp1 to improve image processing performance. everything is much faster , but til yet i just had effects applied to some elements in my wpf forms, that i actually want to avoid.

we have a bunch of image processing functionality and i'd like to replace some othe the stuff piece by piece with pixel shaders to gain some performance. is there a way to apply such a pixel shader to an ImageSource without having to display it?

+3  A: 

Seeing you did not get any answer yet from C# experts, I will try to approach this from C++ DirectX developer perspective, hoping that if my answer is not useful, at least it will point you in the right direction. I know little about C# and nothing about how PixelShaders are supported, therefore chance is am complete wrong and what I write here does not apply at all. In such case feel free to comment or down vote as needed

What is generally done in C++ / DirectX to achive this is:

Preparation (done once)

  • Create render target using CreateRenderTarget
  • Create off-screen surface using CreateOffscreenPlainSurface
  • Set render target surface using SetRenderTarget
  • Create any other input resources needed (Textures, Vertex Buffers ...)

Rendering (done multiple times)

  • Update input resources (textures, buffers) as needed
  • Render
  • Copy the contents of the render target into the off-screen surface via GetRenderTarget
  • Lock the off-screen surface and read its content on the CPU
Suma