Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Screenshot with FMX and normal mode

Post Reply
Esico
Posts: 11
Joined: Wed Jan 01, 2020 4:39 pm

Screenshot with FMX and normal mode

Post 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,
User avatar
salvadordf
Posts: 4047
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Screenshot with FMX and normal mode

Post 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.
Esico
Posts: 11
Joined: Wed Jan 01, 2020 4:39 pm

Re: Screenshot with FMX and normal mode

Post by Esico »

Thanks,

Im using the TFMXChromium (using SimpleFMXBrowser example) now. Should I replace it with the TChromium ? TFMXChromium does not have that procedure.
Esico
Posts: 11
Joined: Wed Jan 01, 2020 4:39 pm

Re: Screenshot with FMX and normal mode

Post by Esico »

I think that does not work:

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

the bitmap here is a VCL bitmap. Not compatible :(
User avatar
salvadordf
Posts: 4047
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Screenshot with FMX and normal mode

Post by salvadordf »

You're right. Sorry for the confusion.

I'll try to create a TakeSnapshot function for TFMXChromium
Esico
Posts: 11
Joined: Wed Jan 01, 2020 4:39 pm

Re: Screenshot with FMX and normal mode

Post 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
User avatar
salvadordf
Posts: 4047
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Screenshot with FMX and normal mode

Post 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.
Post Reply