Off-screen rendering / Page Image Buffer

1,262 views
Skip to first unread message

Enes Karaca

unread,
Feb 20, 2012, 7:39:14 AM2/20/12
to cef...@googlegroups.com
Hello,

How can i access the page image rendered by CEF?

I am will try to read window contents from window handle as the last resort,i am guessing there should be a neater solution.

Off-screen/windowless rendering would be better.

Dmitry Azaraev

unread,
Feb 20, 2012, 7:43:28 AM2/20/12
to cef...@googlegroups.com
Hi.

You need to enable offscreen rendering ('window rendering disabled' in browser settings).
And you need provide CefRenderHandler (in CefClient) which will be notified when some rect updated (render handler used only in offscreen rendering mode).
Also you need to check interop code impls, 'cause it may be broken / not implemented (it is trivial).

--
Best regards,
   Dmitry                             mailto:fdd...@gmail.com

Enes Karaca

unread,
Feb 20, 2012, 8:50:25 AM2/20/12
to cef...@googlegroups.com
Okay, thanks. Looking in to it now.

Enes Karaca

unread,
Feb 20, 2012, 9:57:35 AM2/20/12
to cef...@googlegroups.com
There is SetAsOffScreen in CefWindowInfo, but i can't seem to find the one in browser settings?

Dmitry Azaraev

unread,
Feb 20, 2012, 9:59:34 AM2/20/12
to cef...@googlegroups.com
Oh, it is my bad. Actually SetAsOffScreen method located in CefWindowInfo.

On Mon, Feb 20, 2012 at 4:57 PM, Enes Karaca <gquad...@gmail.com> wrote:
There is SetAsOffScreen in CefWindowInfo, but i can't seem to find the one in browser settings?



Enes Karaca

unread,
Feb 21, 2012, 3:39:23 AM2/21/12
to cef...@googlegroups.com
Render handlers seems to be working but dirty rects are always 0by0. I guess that's because i do not set the width and height of the page. How do i do that when there is no window?

Dmitry Azaraev

unread,
Feb 21, 2012, 4:29:45 AM2/21/12
to cef...@googlegroups.com
What version you are using?
In latest commit https://bitbucket.org/fddima/cefglue/src/b1de2b7ee50c/CefGlue/Handler/CefRenderHandler.Impl.cs  (on_paint method throws NotImplementedException).


On Tue, Feb 21, 2012 at 10:39 AM, Enes Karaca <gquad...@gmail.com> wrote:
Render handlers seems to be working but dirty rects are always 0by0. I guess that's because i do not set the width and height of the page. How do i do that when there is no window?

Enes Karaca

unread,
Feb 21, 2012, 4:32:24 AM2/21/12
to cef...@googlegroups.com
0.5.0.1

Dmitry Azaraev

unread,
Feb 21, 2012, 4:34:20 AM2/21/12
to cef...@googlegroups.com
Ah. Ok.
You must set window size by CefBrowser.SetSize method.

        /// <summary>
        /// Set the size of the specified element.
        /// This method is only used when window rendering is disabled.
        /// </summary>
        public void SetSize(CefPaintElementType type, int width, int height)

On Tue, Feb 21, 2012 at 11:32 AM, Enes Karaca <gquad...@gmail.com> wrote:
0.5.0.1

Enes Karaca

unread,
Feb 22, 2012, 3:43:17 AM2/22/12
to cef...@googlegroups.com
Worked fine so far, but in the scenario i am using, copying dirtyrext pixel-by-pixel is really slow.

Is there a way to get the BGRA buffer of complete page? Buffer i am using to display page is also BGRA, if i can get the buffer of the page then i can just marshall copy that buffer.

Dmitry Azaraev

unread,
Feb 22, 2012, 3:50:31 AM2/22/12
to cef...@googlegroups.com
I'm not sure that you can obtain complete buffer of page. You can ask about this on CEF forum.
I think you just need to find more faster solution for copying dirty rects.

On Wed, Feb 22, 2012 at 10:43 AM, Enes Karaca <gquad...@gmail.com> wrote:
Worked fine so far, but in the scenario i am using, copying dirtyrext pixel-by-pixel is really slow.

Is there a way to get the BGRA buffer of complete page? Buffer i am using to display page is also BGRA, if i can get the buffer of the page then i can just marshall copy that buffer.



Enes Karaca

unread,
Feb 22, 2012, 7:06:08 AM2/22/12
to cef...@googlegroups.com
Okay, thanks for the help.

Enes Karaca

unread,
Feb 25, 2012, 9:32:01 PM2/25/12
to cef...@googlegroups.com
If anyone else needs it, turns out there is a function called CefBrowser.GetImage, which gives complete buffer of the page.


22 Şubat 2012 Çarşamba 10:50:31 UTC+2 tarihinde Dmitry Azaraev yazdı:
Reply all
Reply to author
Forward
0 new messages