在Windows Phone 8的设备方向 [英] Device Orientation in Windows Phone 8
本文介绍了在Windows Phone 8的设备方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想根据在Windows Phone 8的设备的方向旋转图像同时采取使用PhotoCaptureDevice选项卡。
I want to rotate the Image based on the device orientation in Windows Phone 8 while taking the snap using PhotoCaptureDevice option.
当设备的方向是
LandscapeLeft - Image to be rotated to -90
LandscapeRight - Image to be rotated to 90
但没有选项查找在Windows Phone 8设备的方向。你能不能请人帮助我在此
But there is no option to find the device orientation in the Windows Phone 8 . Could you please anyone help me on this ?
推荐答案
您可以使用加速度传感器的读数,然后采取ATAN2如下:<? / p>
You can use the acceleration sensor readings and then take the atan2 as follows:
angle = Math.Atan2(-x,y) * 180.0 / Math.PI;
,其中角是设备的方向relativ到默认的纵向。
where "angle" is the device orientation relativ to the default portrait orientation.
这篇关于在Windows Phone 8的设备方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文