I have a byte array of alpha values and a WriteableBitmap I want to apply those alpha values to. My current solution is something like:
for(int x = 0; x < width; x++)
for (int y = 0; y < height; y++)
var pixel = WriteableBitmap.GetPixel(x, y);
pixel.A = array[x, y];
WriteableBitmap.SetPixel(x, y, pixel);
I could pull out the GetPixel/SetPixel logic for a small speed boost but I feel like something like a Buffer.BlockCopy could be much faster than what I'm doing. I just don't know how to go about implementing it. Any suggestions are welcome, thanks.