0

Is there more efficient way to render a visual to a bitmap? I am trying to use shader effects on UI elements and then I want to modify the result in code pixel-by-pixel. Now I use something like this:

        Button btn = new Button();
        btn.Effect = new BlurEffect();
        RenderTargetBitmap rbmp = new RenderTargetBitmap(64, 64, 96d, 96d, PixelFormats.Pbgra32);
        rbmp.Render(btn); // this is very slow
        byte[] pixels = new byte[64 * 64 * 4];
        int str = width * PixelFormats.Pbgra32.BitsPerPixel / 8;
        rbmp.CopyPixels(pixels, str, 0);

Is there any way to get these pixels of post-processed Button into array without using slow rendering used in RenderTargetBitmap?

szpada87
  • 1
  • 1

1 Answers1

0

Ok, I found an answer... It is impossible :/ There is currently a request for MS to implement hardware accelerated rendering for RenderTargetBitmap but in my opinion MS is not willing to do this. Case closed :(

szpada87
  • 1
  • 1