Convert Simple Orientation To Video Rotation - CSharp Windows.Devices.Sensors

CSharp examples for Windows.Devices.Sensors:SimpleOrientation

Description

Convert Simple Orientation To Video Rotation

Demo Code


using Windows.Storage.FileProperties;
using Windows.Media.Capture;
using Windows.Graphics.Display;
using Windows.Devices.Sensors;
using Windows.Devices.Enumeration;
using System;/*from w ww  .  j  a v  a2s .  co m*/

public class Main{
        private static VideoRotation ConvertSimpleOrientationToVideoRotation(SimpleOrientation orientation)
        {
            switch (orientation)
            {
                case SimpleOrientation.Rotated90DegreesCounterclockwise:
                    return VideoRotation.Clockwise270Degrees;
                case SimpleOrientation.Rotated180DegreesCounterclockwise:
                    return VideoRotation.Clockwise180Degrees;
                case SimpleOrientation.Rotated270DegreesCounterclockwise:
                    return VideoRotation.Clockwise90Degrees;
                case SimpleOrientation.NotRotated:
                default:
                    return VideoRotation.None;
            }
        }
}

Related Tutorials