Page 1 of 1

Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 4:52 pm
by Esico
Hi

I know about the VCL and screenshots but not FMX and in normal mode.

Is there a build-in feature to make a screenshot in FMX and normal mode?

Thanks,

Re: Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 5:14 pm
by salvadordf
Hi,

You should be able to get a screenshot with an FMX application if you call TChromium.TakeSnapshot

Make sure you set GlobalCEFApp.EnableGPU to FALSE before the GlobalCEFApp.StartMainProcess call in the DPR file because TChromium.TakeSnapshot only works when hardware acceleration is disabled.

Re: Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 5:32 pm
by Esico
Thanks,

Im using the TFMXChromium (using SimpleFMXBrowser example) now. Should I replace it with the TChromium ? TFMXChromium does not have that procedure.

Re: Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 5:40 pm
by Esico
I think that does not work:

function TChromium.TakeSnapshot(var aBitmap : TBitmap) : boolean;

the bitmap here is a VCL bitmap. Not compatible :(

Re: Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 6:13 pm
by salvadordf
You're right. Sorry for the confusion.

I'll try to create a TakeSnapshot function for TFMXChromium

Re: Screenshot with FMX and normal mode

Posted: Wed Jan 01, 2020 6:24 pm
by Esico
I already found one, its looks a lot like your code. It still uses vcl bitmap but uses streaming between that vcl and the FMX bitmap.

https://github.com/z505/screenshot-delphi

Re: Screenshot with FMX and normal mode

Posted: Thu Jan 02, 2020 7:13 pm
by salvadordf
Please, download CEF4Delphi again from GitHub.

I just uploaded a new version with 2 new functions :
  • TFMXChromium.TakeSnapshot
  • TFMXChromium.SaveAsBitmapStream
I also added a "snapshot" button in the SimpleFMXBrowser demo.