Screenshot

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

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.

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


Pieter Scheldeman2014-11-12 03:22:21

Thanks Pieter!

I will try it.

Hello,



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



Gert

Hi, 

You can use the code that is added in a tip and faq:
http://tmssoftware.com/site/tmsfmxwebgmaps.asp?s=faq&show=663

Kind Regards, 
Pieter