Chromium Embedded Framework: Can I render into a canvas using DirectX?

旧城冷巷雨未停 提交于 2019-12-23 04:12:24

问题


i want to embed CEF into my DirectX application. Now I want to draw onto a Canvas element in the displayed html page using DirectX. This canvas may be obscured by other html elements above it so I cannot just take the absolute Canvas coordinates and render on it because then it would also render onto the elements on my canvas.

I see two possibilities to solve this:

  • I can make CEF display my texture in the page, so CEF uses my bytebuffer as an image and updates that area frequently.
  • I can get the area of the screen where the Canvas element is and that can actually be seen.

I could not find out if any of those two possibilities is possible in the docs or the sample application.

So my question is: Is this possible to achieve with CEF? And if yes how.


回答1:


The CEF feature what you are looking for named "off-screen rendering" and in this year it is renamed to "windowless rendering".

What are really available just now (in stable 1916 branch) - it is rendering to pixel buffer by software-only renderer. After this you can move your's pixel buffer to surface. Note that software renderer did not support gpu-only accelerated content. I.e. something like 3D CSS transforms and some animations will not work. But in general it is works fine.

You can test this mode by running cefclient --off-screen-rendering-enabled.

In CEF trunk branch 2042 - it is switched to new rendering codepath. And once issue https://code.google.com/p/chromiumembedded/issues/detail?id=1006 will be resolved - you can able to render directly into surface.

Hope this helps.



来源:https://stackoverflow.com/questions/24535989/chromium-embedded-framework-can-i-render-into-a-canvas-using-directx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!