Ejemplo n.º 1
0
        public static WriteableBitmap TransformBitmapByCameraTypeAndPageOrientation(WriteableBitmap writeableBmp, CameraType cameraType, PageOrientation orientation)
        {
            if (cameraType == CameraType.FrontFacing)
            {
                if (orientation == PageOrientation.LandscapeRight)
                {
                }
                else if (orientation == PageOrientation.LandscapeLeft)
                {
                    writeableBmp = writeableBmp.Rotate(180);
                }
                else if (orientation == PageOrientation.PortraitUp)
                {
                    writeableBmp = writeableBmp.Rotate(90);
                }
                writeableBmp = writeableBmp.Flip(WriteableBitmapExtensions.FlipMode.Horizontal);
            }
            else
            {
                if (orientation == PageOrientation.LandscapeRight)
                {
                    writeableBmp = writeableBmp.Rotate(180);
                }
                else if (orientation == PageOrientation.LandscapeLeft)
                {
                }
                else if (orientation == PageOrientation.PortraitUp)
                {
                    writeableBmp = writeableBmp.Rotate(90);
                }
            }

            return writeableBmp;
        }