有没有更有效的方法将视觉呈现给位图?我正在尝试对 UI 元素使用着色器效果,然后我想逐像素地修改代码中的结果。现在我使用这样的东西:
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);
有没有办法在不使用 RenderTargetBitmap 中使用的慢速渲染的情况下将这些后处理按钮的像素放入数组中?