Page 1 of 1
TakeSnapshot - Black screen
Posted: Mon Nov 18, 2019 9:31 pm
by giovani.erthal
I have the following code:
Code: Select all
APrint := TBitmap.Create;
try
if CefWindowParent1.TakeSnapshot( APrint ) = True then
APrint.SaveToFile( 'Test.bmp' );
finally
if ( APrint <> nil ) and ( Assigned( APrint ) = True ) then
APrint.Free;
end;
But the saved Bitmap is a black screen.
I am using Lazarus 2.0.6 64 Bit (CEF 78.2.9).
I already tried to disable hardware acceleration(GlobalCEFApp.EnableGPU := False), and the result is the same.
Does anyone know why this is happening?
Re: TakeSnapshot - Black screen
Posted: Mon Nov 18, 2019 9:54 pm
by giovani.erthal
I just tested the SimpleOSRBrowser demo, and on it, the page content is all black.

Re: TakeSnapshot - Black screen
Posted: Tue Nov 19, 2019 1:07 pm
by salvadordf
Hi,
It's the first time I see that black screen in the SimpleOSRBrowser demo.
Download the official CEF sample application to see if google.com is shown correctly. Perhaps there's a hardware compatibility problem :
http://opensource.spotify.com/cefbuilds ... nt.tar.bz2
Please, update CEF4Delphi to the latest version in the development branch and install it in Lazarus :
https://github.com/salvadordf/CEF4Delphi
You will need to download the latest CEF binaries using the links in the "readme.md" file.
Re: TakeSnapshot - Black screen
Posted: Tue Nov 19, 2019 4:18 pm
by giovani.erthal
Upgrading the version, the OSR demo works perfectly.
However, the TakeSnapshot function continues to capture a black screen.
Re: TakeSnapshot - Black screen
Posted: Thu Nov 21, 2019 11:02 am
by salvadordf
Sorry for the delay.
I could finally reproduce this issue by running the demo in Windows 10. It works fine in Windows 7.
Re: TakeSnapshot - Black screen
Posted: Thu Nov 21, 2019 11:17 am
by salvadordf
Re: TakeSnapshot - Black screen
Posted: Fri Nov 22, 2019 6:17 pm
by giovani.erthal
Thank you very much for your attention, congratulations on the product and sorry for the delay.
I use Windows 10, did not have the opportunity to test on Windows 7.
I may be wrong, but I looked at the TakeSnapShot function code, and apparently it doesn't work if the application is minimized, is this correct?
Using Browser in OSR mode, is it possible to take a screenshot with the minimized application?
Re: TakeSnapshot - Black screen
Posted: Fri Nov 22, 2019 8:07 pm
by salvadordf
The SimpleOSRBrowser demo has some calls to TChromium.WasHidden, TChromium.SendFocusEvent, TChromium.WasResized when the form is hidden or is resized.
Download the latest CEF4Delphi release to avoid a known crash when the OSR browser is resized and try removing those calls when the form is being minimized.
If the browser thinks that it's always focused and visible you should be able to take snapshots.
Use this release to avoid issues :
https://github.com/salvadordf/CEF4Delph ... ses/latest