5

我想在使用 PhotoCaptureDevice 选项拍摄快照时根据 Windows Phone 8 中的设备方向旋转图像。

当设备方向为

LandscapeLeft  - Image to be rotated to -90
LandscapeRight - Image to be rotated to 90

但是在 Windows Phone 8 中没有找到设备方向的选项。你能请任何人帮助我吗?

4

2 回答 2

6

您可以使用加速度传感器读数,然后按如下方式获取 atan2:

angle = Math.Atan2(-x,y) * 180.0 / Math.PI;

其中“角度”是相对于默认纵向方向的设备方向。

于 2012-12-06T14:49:21.600 回答
-2

您需要重写PhoneApplicationPage.OnOrientationChanged方法以获取有关方向何时更改的通知。您需要确保您的页面支持您首先需要的各种方向。

然后您可以根据此更改图像方向。

于 2012-12-06T11:05:53.117 回答