1
這是我迄今爲止嘗試的方向,我面臨的問題potraitdown它顯示圖像在兩個招,我想要做的是首先默認攝像頭的方向和第二放大和捕捉圖像使用canavas我可以放大和縮小相機,我也有方向錯誤的Windows Phone應用程序
之前縮小我在XAML
<Canvas x:Name="viewfinderCanvas" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,10">
<Canvas.Background>
<VideoBrush x:Name="viewfinderBrush">
<VideoBrush.RelativeTransform>
<CompositeTransform
x:Name="viewfinderTransform"
CenterX="0.5"
CenterY="0.5"
Rotation="-90" />
</VideoBrush.RelativeTransform>
</VideoBrush>
</Canvas.Background>
</Canvas>
寫了這個代碼這是用於定向C#
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
if (cam != null)
{
if (e.Orientation == PageOrientation.LandscapeRight)
{
landscapeRightRotation = 180;
// Rotate for LandscapeRight orientation.
viewfinderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
}
else if (e.Orientation == PageOrientation.PortraitUp)
{
landscapeRightRotation = -90;
viewfinderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
}
else if (e.Orientation == PageOrientation.PortraitDown)
{
landscapeRightRotation = 0;
// Rotate for LandscapeRight orientation.
viewfinderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation };
}
else
{
viewfinderBrush.RelativeTransform =
new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 };
}
}
viewfinderTransform.ScaleY = 0;
base.OnOrientationChanged(e);
}
需要幫助以獲取默認方向或角度,因爲內置攝像頭具有 –