Turan Can 3 Posted January 28, 2021 (edited) Hello everyone, Full screenshot. How do I capture the entire screen? In this example, I can take a screenshot of the open form. Sample; function MakeScaleScreenshot(Sender: TObject): TBitmap; var fScreenScale: Single; function GetScreenScale: Single; var ScreenService: IFMXScreenService; begin Result := 1; if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenService)) then begin Result := ScreenService.GetScreenScale; end; end; begin fScreenScale := GetScreenScale; Result := TBitmap.Create(Round(TfmText1(Sender).Width * fScreenScale), Round(TfmText1(Sender).Height * fScreenScale)); Result.Clear(0); if Result.Canvas.BeginScene then try TfmText1(Sender).PaintTo(Result.Canvas); // Sender.PaintTo( Result.Canvas); //, RectF(0, 0, Result.Width, Result.Height)); finally Result.Canvas.EndScene; end; end; procedure TfmText1.btnScreenClick(Sender: TObject); var B: TBitmap; begin B := MakeScaleScreenshot(Self); // MakeScreenshot(Image1); Image1.Bitmap.Assign(B); B.DisposeOf; end; Edited January 28, 2021 by Turan Can Share this post Link to post
Lars Fosdal 1792 Posted January 28, 2021 http://forum.codecall.net/topic/60613-how-to-capture-screen-with-delphi-code/ Share this post Link to post
M.Joos 30 Posted January 28, 2021 9 minutes ago, Lars Fosdal said: http://forum.codecall.net/topic/60613-how-to-capture-screen-with-delphi-code/ Unfortunately this is for Windows only - The OP is interested in something for Android if you look at the screenshot in his post. Share this post Link to post
Lars Fosdal 1792 Posted January 28, 2021 Doh! The risks of reading the Unread Content list and not paying attention which subforum the post is in. My bad. Share this post Link to post
Lars Fosdal 1792 Posted January 28, 2021 https://blog.mindorks.com/how-to-programmatically-take-a-screenshot-on-android explains how to do it in Java - but the question remains - how to get hold of the parent handle/coordinates in Delphi? Share this post Link to post
Turan Can 3 Posted January 28, 2021 (edited) In the Java example, it did not capture the entire screen, but took a screenshot of the form it was attached to. so it is no different from the sample code I made. I think I need to take a screenshot with a handle from a plugin or api. but I could not find any examples android. Delphi, Java, C# xamarin I could not find an example of a full screenshot for android in these 3 languages. 1- Java sample 2- java sample Edited January 28, 2021 by Turan Can Share this post Link to post
limelect 48 Posted January 28, 2021 I did compile this it workes great hop it will help you https://github.com/HBiSoft/HBRecorder Share this post Link to post
Turan Can 3 Posted January 28, 2021 Hi limelect, As I share in the picture, can it get the top bar and bottom bar showing clock and battery? Share this post Link to post
limelect 48 Posted January 28, 2021 It works by taking the whole! Android screen and puts it in a video including audio!!! I compiled it in Android Studio. Share this post Link to post
limelect 48 Posted January 28, 2021 If you are Ok with Java you can translate it to Delphi. Go to F-Droid Best for Android sources 1 Share this post Link to post
Turan Can 3 Posted January 28, 2021 (edited) Limelect, There is no code language issue for me. I am reviewing what you sent. Thanks a lot for the information. There are several api used in the code you sent, I'll review them. Edited January 28, 2021 by Turan Can 1 Share this post Link to post
Guest Posted February 5, 2021 (edited) in FMX you can use "Layout" component (covering the entire application area - main form, for example) in your forms or in main-form or any other control that can use "MakeScreenShot" procedure! FMX.Controls.TControl.MakeScreenshot Takes and returns a screenshot of the control = to a bitmap for easy use, you can create a "template" for all forms - visual inherit program Project1; uses System.StartUpCopy, FMX.Forms, uTemplateForAllForms in 'uTemplateForAllForms.pas' {frmTemplateForAllForms} , uFormMain in 'uFormMain.pas' {frmFormMain}; {$R *.res} begin Application.Initialize; Application.CreateForm(TfrmFormMain, frmFormMain); Application.Run; end. type TfrmTemplateForAllForms = class(TForm) Layout1: TLayout; // align = client - and it will be the "container" for all other components btnMakeScreenShot: TButton; procedure btnMakeScreenShotClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var frmTemplateForAllForms: TfrmTemplateForAllForms; implementation {$R *.fmx} procedure TfrmTemplateForAllForms.btnMakeScreenShotClick(Sender: TObject); var lMyBitmap: TBitmap; begin // return a bitmap for a public/private "var" like this lMyBitmap := Layout1.MakeScreenshot; end; ... uTemplateForAllForms, FMX.Controls.Presentation, FMX.Layouts; type TfrmFormMain = class(TfrmTemplateForAllForms) private { Private declarations } public { Public declarations } end; var frmFormMain: TfrmFormMain; // this my main-form on Project-Options hug Edited February 5, 2021 by Guest Share this post Link to post
Turan Can 3 Posted February 5, 2021 The problem is solved. I convert from the Java example. Thanks. It only receives the form you send. Please check the picture above. 1 Share this post Link to post
Guest Posted February 5, 2021 10 minutes ago, Turan Can said: The problem is solved. I convert from the Java example. Thanks. It only receives the form you send. Please check the picture above. Here a good sample for your question, too! - in Java code All screen on Android include button-bars https://ssaurel.medium.com/taking-a-screenshot-programmatically-in-android-apps-67619cb80bf8 Share this post Link to post
xorpas 4 Posted February 22, 2021 On 2/5/2021 at 6:34 AM, Turan Can said: The problem is solved. I convert from the Java example. Thanks. It only receives the form you send. Please check the picture above. How you solved this problem Can you put Your Code Hier ? 1 Share this post Link to post