Start a new topic

Remove HTML elements and cams from the snapshot

Remove HTML elements and cams from the snapshot


Hi,

Is it possible remove HTML elements (radar) and other drawables.cam from the screen before the snapshot without doing it manually? Maybe do a function exist?
Hi luca,
You can exclude the webview from the screen shot. The API for all platfrom offers an additional parameter to do so. Please refer to the documentation for more information.
Please also have a look at our SDK example app which includes a sample that takes a screen shot and saves it to the device photo library.

iOS:
captureScreenWithMode:usingSaveMode:saveOptions:context: Triggers the generation of a UIImage which contains a screenshot of the next available frame.
  • (void)captureScreenWithMode:(WTScreenshotCaptureMode)captureMode usingSaveMode:(WTScreenshotSaveMode)saveMode saveOptions:(WTScreenshotSaveOptions)options context:(NSDictionary *)context

Parameters
  • captureMode: Defines if the WebView is included in the screenshot or not.
  • saveMode: Defines how the captured screenshot should be processed. Possible ways are to save it to the Photo Library, to a specific bundle directory or to receive a delegate call where the image is passed in.
  • options: Defines more option for a specific SaveMode.
  • context: A NSDictionary containing information about the CaptureMode, SaveMode and SaveMode specific objects. See Protocol reference for more information.

Declared In
  • WTArchitectView.h

Android:
captureScreen

public void captureScreen(int captureMode,
FileOutputStream fOut)
throws IllegalArgumentException

captures currently visible screen and saves it as png to given location

Parameters:
captureMode - as in CaptureScreenCallback.CAPTURE_MODE_*
fOut - the outputstream to store the png at
Throws:
IllegalArgumentException

captureScreen
public void captureScreen(int captureMode,
ArchitectView.CaptureScreenCallback callback)
throws IllegalArgumentException

captures currently visible screen and passes callback picture as Bitmap

Parameters:
captureMode - as in CaptureScreenCallback.CAPTURE_MODE_*
callback - callback to invoke once bitmap is ready (may take some milli-seconds)
Throws:
IllegalArgumentException

PhoneGap:
captureScreen
Use this function to generate a screenshot from the current Wikitude SDK view.
@param {bool} includeWebView: Indicates if the ARchitect web view should be included in the generated screenshot or not.
@param {string} imagePathInBundleorNullForPhotoLibrary: If a file path or file name is given, the generated screenshot will be saved in the application bundle. Passing null will save the photo in the device photo library.
@param {function} onCapturedScreen: A function that is called when the screen could be successfully captured. The bundle path is passed to the function when the photo was saved into the application bundle.
@param {function} onErrorCapturedScreen: A function that is called when an error occurred during screen capturing.

Usage:
wikitudePlugin.captureScreen(true, null, onCapturedScreen, onErrorCaptureScreen);

Titanium:
captureScreen
Use this function to generate a screenshot from the current Wikitude SDK view.
@param {bool} includeWebView: Indicates if the ARchitect web view should be included in the generated screenshot or not.
@param {string} imagePathInBundleorNullForPhotoLibrary: If a file path or file name is given, the generated screenshot will be saved in the application bundle. Passing null will save the photo in the device photo library.
@param {function} onSuccess: A function that is called when the screen could be successfully captured. The bundle path is passed to the function when the photo was saved into the application bundle.
@param {function} onError: A function that is called when an error occurred during screen capturing.

Usage:
wikitude.captureScreen(includeWebView, "/Path/In/Bundle/toImage.png", {
onSuccess: function(path) {
alert('success: ' + path);
},
onError: function(errorDescription) {
alert('error: ' + errorDescription);
}
});


Sorry, maybe I did not explain well. I know how I can do a snapshot with wikitude captureScreen method (iOS), but before doing this, I want to remove POI and radar from the screen so they will not appear in the image.

For example, I activate the 3D model and I want to see also POIs and radar. But when I do the snapshot I wanto to see in the saved image only the 3D model...

A method like this

 

-(void)captureScreenWithMode:(WTScreenshotCaptureMode)captureMode usingSaveMode:(WTScreenshotSaveMode)saveMode saveOptions:(param)param context:(param)param snapshotOnly:(AR.Object)objectToPhoto

To do this I have to hide manually al the things and then make them appear again? Or is there something already done?

 

 

Sorry, I misunderstood you.
You need to manually hide the Radar and all of your POIs before taking the screenshot. There is no build in functionality for that.

Best regards

Andreas

Ok thanks Andreas.

There is a method or an object that I can iterate to inspect elements one on one? (in JS)

Hi Luca,
You get the cam, radar or inidcator drawables from each GeoObject or Trackable2DObject but you need to keep your own list of those created GeoObjects & Trackable2DObjects.

 

var geoObject = new AR.GeoObject(...);
var geoObjectCamDrawables = geoObject.drawables.cam;

var trackable = new AR.Trackable2DObject(...);
var trackableCamDrawables = trackable.drawables.cam;

 

Best regards

Andreas
Login or Signup to post a comment