C # GDI + / System.Drawing.Graphics - buffer creation and routine beating?

I am creating a cad viewer that deals with very large image files and I am trying to optimize it for as high frame rate and low memory level as possible.

It uses GDI + for panel rendering.

This drawback is image rendering. In some files I use reference images that are especially large (8000x8000 pixels). I optimized memory usage by only loading them when they become visible, and getting rid of them when they don't. This reduces the likelihood that the program will run out of memory, but does not allow you to load and unload images too often; however, rendering the images themselves (context.DrawImage) still carries a very large overhead.

Now I’m learning how to mix images in a smaller buffer, rendering this (usually much smaller) buffer, and then updating / restoring it with a significant change in the zoom level.

The problem is that I cannot find any provisions for this in GDI. Can anyone suggest how I could achieve this?

+6
c # winforms gdi + graphics drawing
source share
4 answers

GDI Binned is in favor of Direct3D, because 3D elements are included in the equation anyway. Images have turned into single thumbnails and large tiles that are downloaded to / from as needed.

0
source share

I don't think GDI is designed for such high-speed image updates. If you are trying to scroll the image and track with the mouse with each movement, try shifting the sections of the image and filling in the space opened by the shift. Essentially the reuse of tricks that programmers use to smoothly scroll / pan graphics while the processor is slow and the RAM is small.

+2
source share

If you are creating a new graphical application that needs a high frame rate and are looking for suggestions, I suggest abandoning GDI + and using WPF. WPF uses hardware acceleration and supports graphics with saved mode; it has much better performance for less than GDI +.

If there is any restriction prohibiting WPF, explain this in your question. This is relevant because such restrictions may also affect the GDI + pattern.

+2
source share

I had a similar problem while developing my own GIS application. The best solution I have found for this (even when using WPF) is to split large images and display only the visible parts. This suggests that I would switch to WPF not only for the reasons mentioned in the above answers, but also for good image support. See this link for more information.

0
source share

All Articles