This is my function but it runs too slowly. Can anyone help me speeding it up?
void LayerShow(Color[,] layer)// Shows a layer in the panel.
{
for (int y = 0; y < CanvasDimY; y++)
{
for (int x = 0; x < CanvasDimX; x++)
{
image.SetPixel(x, y, layer[x, y]);
}
}
PanelCanvas.BackgroundImage = image;
PanelCanvas.Refresh();
}
What I have tried:
I have looked online for alternatives to SetPixel, and there seem to be some, but I have not been able to integrate the examples in my code. There is always something that you need to do to make it work, that they forget to mention.