我有两个图像,我想将一个位图图像精确地保存在另一个位置,在它存在的同一点我也使用手势移动图像.
public Bitmap combineImages(Bitmap ScaledBitmap, Bitmap bit) {
int X = bit.getWidth();
int Y = bit.getHeight();
Scaled_X = ScaledBitmap.getWidth();
scaled_Y = ScaledBitmap.getHeight();
System.out.println("Combined Images");
System.out.println("Bit :" + X + "/t" + Y);
System.out.println("SCaled_Bitmap :" + Scaled_X + "\t" + scaled_Y);
overlaybitmap = Bitmap.createBitmap(ScaledBitmap.getWidth(),
ScaledBitmap.getHeight(), ScaledBitmap.getConfig());
Canvas canvas = new Canvas(overlaybitmap);
canvas.drawBitmap(ScaledBitmap, new Matrix(), null);
canvas.drawBitmap(bit, new Matrix(), null);
return overlaybitmap;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我正在使用react-native-maps并且使用此代码得到纬度和经度:
callLocation(that) {
navigator.geolocation.getCurrentPosition(
position => {
const currentLongitude = JSON.stringify(position.coords.longitude);
const currentLatitude = JSON.stringify(position.coords.latitude);
that.setState({ currentLongitude: currentLongitude });
that.setState({ currentLatitude: currentLatitude });
},
error => alert(error.message),
{ enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
);
that.watchID = navigator.geolocation.watchPosition(position => {
console.log(position);
const currentLongitude = JSON.stringify(position.coords.longitude);
const currentLatitude = JSON.stringify(position.coords.latitude);
that.setState({ currentLongitude: currentLongitude });
that.setState({ currentLatitude: currentLatitude });
});
}
Run Code Online (Sandbox Code Playgroud)
这是我的地图视图代码:
<MapView
style={styles.map}
initialRegion={{
latitude: this.state.currentLatitude,
longitude: this.state.currentLongitude,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421
}}
/>
Run Code Online (Sandbox Code Playgroud)
当我将这个纬度和经度粘贴到我的代码中时,出现以下错误: