Fast 2D graphics in WPF

前端 未结 5 1195
庸人自扰
庸人自扰 2020-12-12 13:42

I need to draw a large amount of 2D elements in WPF, such as lines and polygons. Their position also needs to be updated constantly.

I have looked at many of the an

5条回答
  •  我在风中等你
    2020-12-12 14:36

    I believe the sample code provided is pretty much as good as it gets, and is showcasing the limits of the framework. In my measurements I profiled an average cost of 15-25ms is attributed to render-overhead. In essence we speak here about just the modification of the centre (dependency-) property, which is quite expensive. I presume it is expensive because it propagates the changes to mil-core directly.

    One important note is that the overhead cost is proportional to the amount of objects whose position are changed in the simulation. Rendering a large quantity of objects on itself is not an issue when a majority of objects are temporal coherent i.e. don't change positions.

    The best alternative approach for this situation is to resort to D3DImage, which is an element for the Windows Presentation Foundation to present information rendered with DirectX. Generally spoken that approach should be effective, performance wise.

提交回复
热议问题