Convert Simple Orientation To Photo Orientation - CSharp Windows.Devices.Sensors

CSharp examples for Windows.Devices.Sensors:SimpleOrientation

Description

Convert Simple Orientation To Photo Orientation

Demo Code


using Windows.Storage.FileProperties;
using Windows.Media.Capture;
using Windows.Graphics.Display;
using Windows.Devices.Sensors;
using Windows.Devices.Enumeration;
using System;//  ww w  .j  av  a 2s  .  c o  m

public class Main{
        public static PhotoOrientation ConvertSimpleOrientationToPhotoOrientation(SimpleOrientation orientation)
        {
            switch (orientation)
            {
                case SimpleOrientation.Rotated90DegreesCounterclockwise:
                    return PhotoOrientation.Rotate90;
                case SimpleOrientation.Rotated180DegreesCounterclockwise:
                    return PhotoOrientation.Rotate180;
                case SimpleOrientation.Rotated270DegreesCounterclockwise:
                    return PhotoOrientation.Rotate270;
                case SimpleOrientation.NotRotated:
                default:
                    return PhotoOrientation.Normal;
            }
        }
}

Related Tutorials