Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Screenshot

 Post Reply Post Reply
Author
kuhl klaus View Drop Down
New Member
New Member
Avatar

Joined: 29 Oct 2014
Posts: 34
Post Options Post Options   Quote kuhl klaus Quote  Post ReplyReply Direct Link To This Post Topic: Screenshot
    Posted: 04 Nov 2014 at 10:42am
Hello,
I am trying to make a screenshot of the actual WebGMap component.
With the standard delphi functions I only get black screenshots:

    gMap: TTMSFMXWebGMaps;
...
      Image1 := TImage.Create( FHaupt );
      Image1.Bitmap := FHaupt.gMap.MakeScreenshot;
      Image1.Bitmap.SaveToFile( cFilename );

is ist wrong way or someone knows how to do it ?

XE6
firemonkey Android

thanks

Back to Top
kuhl klaus View Drop Down
New Member
New Member
Avatar

Joined: 29 Oct 2014
Posts: 34
Post Options Post Options   Quote kuhl klaus Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2014 at 3:07am
No one with same problem or an idea?

Searching through whole google, it looks no one else has this problem.

I just want to save the screenshot of the google-maps component.

I tried to put the TTMSFMXWebGMaps component on different owners (panels, forms, tabsheets etc),
I tried different scalings,
I tried to copy from the canvas with "DrawtoDC" and a lot of different functions.
There is no pixel to get.

The simpliest test see below. There is a form with TTMSFMXWebGMaps, TImage, a button and two radiobutton.
No style, nothing else.
The MakeScreenshot of the button shows the buttonimage,
the MakeScreenshot of GMaps shows nothing.
No error, and no image.

I am using XE6 .
With firemonkey Android and firemonkey Win32 same effekt.

Help is very welcome!



unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects,
  FMX.StdCtrls, FMX.TMSButton, FMX.TMSWebGMapsWebBrowser, FMX.TMSWebGMaps;

type
  TForm1 = class(TForm)
    TMSFMXWebGMaps1: TTMSFMXWebGMaps;
    TMSFMXButton1: TTMSFMXButton;
    Image1: TImage;
    rbMap: TRadioButton;
    rbButton: TRadioButton;
    procedure TMSFMXButton1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.TMSFMXButton1Click(Sender: TObject);
begin
  if rbMap.IsChecked then begin

    image1.Bitmap := TMSFMXWebGMaps1.MakeScreenshot;   // the image is empty ! :-(
  end else if rbButton.IsChecked then begin

    image1.Bitmap := TMSFMXButton1.MakeScreenshot;    // shows the button in the image
  end;
end;

end.
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3259
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2014 at 3:22am
Hi, 

The WebGMaps uses a native control, which does not use the Canvas as other FireMonkey controls do. So MakeScreenShot will not have any effect. We have not yet investigated here what is possible, but this would be a good place to start: http://stackoverflow.com/questions/9745988/how-can-i-programmatically-take-a-screenshot-of-a-webview-capturing-the-full-pa

The code the access the native WebView is:

  TJWebView.Wrap(TMSFMXWebGMaps1.NativeBrowser).capturePicture;

by adding the AndroidApi.JNI.WebKit unit.

Kind Regards, 
Pieter



Edited by Pieter Scheldeman - 12 Nov 2014 at 3:22am
Back to Top
kuhl klaus View Drop Down
New Member
New Member
Avatar

Joined: 29 Oct 2014
Posts: 34
Post Options Post Options   Quote kuhl klaus Quote  Post ReplyReply Direct Link To This Post Posted: 12 Nov 2014 at 4:39am
Thanks Pieter!

I will try it.
Back to Top
Hoogeboom Gert View Drop Down
New Member
New Member
Avatar

Joined: 15 Nov 2013
Posts: 14
Post Options Post Options   Quote Hoogeboom Gert Quote  Post ReplyReply Direct Link To This Post Posted: 04 Jan 2015 at 3:30pm
Hello,

How can I achieve this ( taking a screenshot of TMSFMXWebGMaps )on a IPad ?

Gert
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3259
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jan 2015 at 2:28am
Hi, 

You can use the code that is added in a tip and faq:

Kind Regards, 
Pieter
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down