问题
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