Hello, I'm Fevzi from Turkey
TakeSnapShot function doesn't work in new versions (>128.4.9 onwards)!
I would be very happy if you could take care of it.
Best regards...
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.
TakeSnapShot function
- salvadordf
- Posts: 4563
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: TakeSnapShot function
Hi,
TChromiumCore.TakeSnapshot copies the DC to a TBitmap. This function only works on Windows with browsers without GPU acceleration.
It's recommended to use the "Page.captureScreenshot" DevTools method instead.
The MiniBrowser demo has all the code you need :
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1593
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1634
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1711
TChromiumCore.TakeSnapshot copies the DC to a TBitmap. This function only works on Windows with browsers without GPU acceleration.
It's recommended to use the "Page.captureScreenshot" DevTools method instead.
The MiniBrowser demo has all the code you need :
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1593
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1634
https://github.com/salvadordf/CEF4Delphi/blob/a7a1fd27ed7f32904340fae6c6ec94c1b679a4a4/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L1711
Re: TakeSnapShot function
These functions save the image to disk!
How can I transfer the screenshot to a bitmap or stream?
How can I transfer the screenshot to a bitmap or stream?
- salvadordf
- Posts: 4563
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: TakeSnapShot function
The last link shows the code that decodes the image into a TBytes variable called "TempData".
Use TStream.WriteBuffer to copy the data to a new TStream :
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TStream.WriteBuffer
Use TStream.WriteBuffer to copy the data to a new TStream :
https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TStream.WriteBuffer