Save to Bitmap Example

743 views
Skip to first unread message

drich...@secondstory.com

unread,
Apr 1, 2013, 8:35:40 PM4/1/13
to cef...@googlegroups.com
Would it be possible to create an example that just saves a screenshot to a bitmap? Without using Windows Forms or WPF?  I've tried extricating the necessary code from the WPFOSR example but I haven't been able to get it to work.  The OnPaint method is never called despite the having overridden GetRenderHandler on the client and having created a render handler with the OnPaint method defined. 

Dmitry Azaraev

unread,
Apr 2, 2013, 4:18:44 AM4/2/13
to cef...@googlegroups.com
Can you provide your's sample?


On Tue, Apr 2, 2013 at 3:35 AM, <drich...@secondstory.com> wrote:
Would it be possible to create an example that just saves a screenshot to a bitmap? Without using Windows Forms or WPF?  I've tried extricating the necessary code from the WPFOSR example but I haven't been able to get it to work.  The OnPaint method is never called despite the having overridden GetRenderHandler on the client and having created a render handler with the OnPaint method defined. 

--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best regards,
   Dmitry

drich...@secondstory.com

unread,
Apr 2, 2013, 12:33:01 PM4/2/13
to cef...@googlegroups.com, dmitry....@gmail.com
Hmm. I've been writing my test to work with OpenTK, an OpenGL library for C#. But you have a good idea.  I will extract the relevant CefGlue code and write an example for saving to a bitmap and then you can review it.  I'll post it once I'm done with it, probably in an hour or so. 

D.  

Dmitry Azaraev

unread,
Apr 2, 2013, 12:33:41 PM4/2/13
to cef...@googlegroups.com
Good idea. Thanks.

Dmitry Azaraev

unread,
Apr 2, 2013, 6:12:49 PM4/2/13
to cef...@googlegroups.com
Implement method in CefSimpleRenderHandler like this:

        protected override bool GetViewRect(CefBrowser browser, ref CefRectangle rect)
        {
            rect = new CefRectangle(0, 0, 300, 200);
            return true;
        }

In this case - OnPaint called. I'm not sure that is happens if view rectange is not provided, but probably it is means drawing on canvas 0x0 (and it is not happens).



On Wed, Apr 3, 2013 at 12:29 AM, <drich...@secondstory.com> wrote:
I've partially completed Save to Bitmap example.  OnPaint in the render handler never gets called.  Could you take a look and tell me why? Once I figure that out I'll be able to complete the example.

I'll share it with the group. 

Donny.  

--
You received this message because you are subscribed to the Google Groups "CefGlue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cefglue+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best regards,
   Dmitry

drich...@secondstory.com

unread,
Apr 2, 2013, 7:29:04 PM4/2/13
to cef...@googlegroups.com, dmitry....@gmail.com
Thanks, I'll try this right away and get back to you.

D. 

drich...@secondstory.com

unread,
Apr 4, 2013, 1:34:52 PM4/4/13
to cef...@googlegroups.com, dmitry....@gmail.com
Here is the example. Let me know if I it looks like I've done anything stupid :)
CefGlueScreenshot.zip

Patrick Ecker

unread,
Jun 6, 2016, 3:45:12 AM6/6/16
to CefGlue
Hi if somebody is still looking of a way to create a Screenshot via CefGlue, check out the repo: https://github.com/Robar666/CefGlueScreenshot
Reply all
Reply to author
Forward
0 new messages