Im writing a program that requires a lot of updates to be made to a 1400 x 900 pixel image (approx every second or so). In my current build i have used a lockbits function which recalls data from an array (which i have used to store data about each pixel on the map) and places the correct pixels on the bitmap.
sample because it wont let me post otherwise
if (enb == 1 || enb == 6 || enb == 7 || enb == 8 || enb == 9)
{
rgbValues[(y * bmpData.Stride) + (x * 4) + 3] = 255; //alpha
rgbValues[(y * bmpData.Stride) + (x * 4) + 2] = Convert.ToByte(provinces[(Convert.ToInt16(tmp3n)), 13]); //red
rgbValues[(y * bmpData.Stride) + (x * 4) + 1] = Convert.ToByte(provinces[(Convert.ToInt16(tmp3n)), 14]); //green
rgbValues[(y * bmpData.Stride) + (x * 4)] = Convert.ToByte(provinces[(Convert.ToInt16(tmp3n)), 15]); //blue
}
My issue is that once there is a large amount of colours on the bitmap, it can take a lot of time for the map to be updated, causing the entire run time to increase too much (late in run time i found it could take five seconds to update the image).
Is there any problems with my current algorithm that might be causing this issue? or is there any more suitable/efficient algorithms i could use instead?
Apologies if this isnt an appropriate question for here, but im stumped on how to do this, and im fairly sure its possible. Thank you <3