使用Windows Phone 7芒果PhotoCamera的ViewFinder方向 [英] ViewFinder Orientation With Windows Phone 7 Mango PhotoCamera

查看:175
本文介绍了使用Windows Phone 7芒果PhotoCamera的ViewFinder方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Phone 7 Mango Beta 2开发工具中使用PhotoCamera控件。

I am using the PhotoCamera control with the Windows Phone 7 Mango Beta 2 development tools.

相机控件的ViewFinder是一个矩形对象, VideoBrush,如下例所示:

The "ViewFinder" for the camera control is a rectangle object filled with a VideoBrush, as in the example here:

http://msdn.microsoft.com/en-us/library/hh202956%28v=VS.92%29.aspx

我的问题是,当我在手机上运行应用程序时,ViewFinder图像总是逆时针旋转90度。

My problem is that when I run the app on my phone, the ViewFinder image is always showing up rotated 90 degrees counter-clockwise. This is the case no matter how the phone is positioned.

有没有人知道如何正确定位ViewFinder?

Does anyone know how I can orient the ViewFinder correctly?

推荐答案

是的,您需要使用相对变换来管理方向:

Yes, the orientation is something you'll need to manage with a Relative Transform:

<!--Camera viewfinder >-->
<Rectangle Grid.Row="1"
            x:Name="preview">
  <Rectangle.Fill>
    <VideoBrush x:Name="previewBrush">
      <VideoBrush.RelativeTransform>
        <CompositeTransform x:Name="previewTransform"
                            CenterX=".5"
                            CenterY=".5" />
      </VideoBrush.RelativeTransform>
    </VideoBrush>
  </Rectangle.Fill>
</Rectangle>

b
$ b

Then you can use the PhotoCamera class to determine how you want to rotate it:

double cameraRotation = theCamera.Orientation;

// Use the orientation to determine how to transform 
// the camera preview
previewTransform.Rotation = theCamera.Orientation + 90.0; // Landscape? 

HTH

这篇关于使用Windows Phone 7芒果PhotoCamera的ViewFinder方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆