Is Graphics.DrawImage too slow for bigger images?

前端 未结 4 686
抹茶落季
抹茶落季 2020-11-29 23:56

I\'m currently working on a game and I wish to have a main menu with background image.

However, I find the method Graphics.DrawImage() really slow. I ha

4条回答
  •  时光取名叫无心
    2020-11-30 00:24

    GDI+ is not a speed demon by any means. Any serious image manipulation usually has to go into the native side of things (pInvoke calls and/or manipulation via a pointer obtained by calling LockBits.)

    Have you looked into XNA/DirectX/OpenGL?. These are frameworks designed for game development and will be orders of magnitude more efficient and flexible than using a UI framework like WinForms or WPF. The libraries all offer C# bindings.

    You could pInvoke into native code, using functions like BitBlt, but there is overhead associated with crossing the managed code boundary as well.

提交回复
热议问题