Bitmap.SetPixel(x,y, Color) too slow

前端 未结 4 1514
醉话见心
醉话见心 2021-01-19 17:44

So currently I\'m creating a 1000x1000 bitmap and it\'s spending about .3 seconds simply calling the Bitmap.SetPixel() function.

I\'m actually only drawing probably

相关标签:
4条回答
  • 2021-01-19 18:21

    Bob Powell has an excellent tutorial on accessing pixel maps directly in memory.

    0 讨论(0)
  • 2021-01-19 18:21

    FastPixel?: http://www.codeproject.com/KB/GDI-plus/FastPixel.aspx

    0 讨论(0)
  • 2021-01-19 18:27

    I can recommend FastBitmap:

    FastBitmap fb = new FastBitmap(b);
    fb.LockImage();
    
    ...
    
    fb.SetPixel(x, y, Color.Red);
    
    ...
    
    fb.UnlockImage();
    
    0 讨论(0)
  • 2021-01-19 18:33

    Modern blockbuster video games do all the pixel setting behind the scenes in hardware; they give the hardware a buffer of geometries and the highly parallelized hardware does all the math. OpenGL and DirectX are APIs for talking to the hardware.

    Search gamedev.net for some tutorials.

    0 讨论(0)
提交回复
热议问题