While experimenting with pixel shaders in WPF I decided to draw some pixels onto a fullscreen image through writeable bitmaps based on the MSDN sample
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx
I used a blur shader on the image.
To have a continuous effect I took the image back from the shader and used it as input on the writeable bitmap.
RenderTargetBitmap rtb = new RenderTargetBitmap((int)width, (int)height, 96, 96.0, PixelFormats.Pbgra32);
rtb.Render(imgBackground);
wb = new WriteableBitmap(rtb);
imgBackground.Source = wb;
The above code is really slow.
I need something to make it faster or some way to apply the pixel shader to the writeable bitmap backbuffer instead of the image.
Thx in advance.
Stuck at this problem for some time now ..
RenderTargetBitmap.Render(…) is always rendered in software on the UI thread, so your pixel shader is even being ran in software.
I am unsure what “effect” you are trying to achieve, but maybe you can just set the blur effect on the imgBackground (ie, imgBackground.Effect = new BlurEffect())