Steen Pedersen

Steen Pedersen

  • 2k
  • 11
  • 513

Faster version of SetPixel

Jun 20 2020 3:55 AM
Im not even sure this question is in the right category.
 
I really need a faster version of this function, and Im too nooby to transfer the online examples into my code:
  1. void LayerShow (Color[,] layer) // Shows a layer in the panel.  
  2. {  
  3. for (int y = 0; y < CanvasDimY; y++)  
  4. {  
  5. for (int x = 0; x < CanvasDimX; x++)  
  6. {  
  7. image.SetPixel(x, y, layer[x, y]);  
  8. }  
  9. }  
  10. PanelCanvas.BackgroundImage = image;  
  11. PanelCanvas.Refresh();  
  12. }  

Answers (2)