简体   繁体   English

捕获Titanium中的Google Map v2 View屏幕截图

[英]Capture Google Map v2 View screen shot in Titanium

I am developing a Titanium app using Google Maps v2. 我正在使用Google Maps v2开发Titanium应用程序。 I want to know is there a hook in Ti that allow me to capture mapview as image. 我想知道Ti中是否有一个钩子,可以将mapview捕获为图像。 I want to take map snap shot at certain point. 我想在特定点拍摄地图快照。

I checked in Android documentation and found it's possible: Capture screen shot of GoogleMap Android API V2 我检查了Android文档,发现有可能: 捕获GoogleMap Android API V2的屏幕截图

https://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.SnapshotReadyCallback.html https://developer.android.com/reference/com/google/android/gms/maps/GoogleMap.SnapshotReadyCallback.html

Anybody does have knowledge if this is possible. 任何人都知道如果可能的话。

You can do this in Titanium. 您可以在Titanium中执行此操作。 Simply refer to the UIView, example: 只需参考UIView,例如:

var snapshotImgBlog = mapView.toImage(); // OR containerViewOfMapView.toImage()

Documentation http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View-method-toImage 文档http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View-method-toImage

If you want to take the snapshot at a certain point on your map, you'll have to position a view on top of the map (can be an empty) at a location (I'll leave the position/size logic up to you) , and use that view: overlayView.toImage() . 如果您想在地图上的某个位置拍摄快照,则必须将视图放置在地图上方(可以为空)在某个位置(我将位置/大小逻辑留给您) ) ,然后使用该视图: overlayView.toImage()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM