ImageProcessor.Processors.Watermark.GetRotateFlipType C# (CSharp) Method

GetRotateFlipType() private method

Gets the correct Nullable{RotateFlipType} to ensure that the watermarked image is correct orientation when the watermark is applied.
private GetRotateFlipType ( ImageFactory factory ) : RotateFlipType?
factory ImageFactory The current .
return RotateFlipType?
        private RotateFlipType? GetRotateFlipType(ImageFactory factory)
        {
            const int Orientation = (int)ExifPropertyTag.Orientation;
            if (factory.PreserveExifData && factory.ExifPropertyItems.ContainsKey(Orientation))
            {
                int rotationValue = factory.ExifPropertyItems[Orientation].Value[0];
                switch (rotationValue)
                {
                    case 8: // Rotated 90 right
                        // De-rotate:
                        return RotateFlipType.Rotate270FlipNone;

                    case 3: // Bottoms up
                        return RotateFlipType.Rotate180FlipNone;

                    case 6: // Rotated 90 left
                        return RotateFlipType.Rotate90FlipNone;
                }
            }

            return null;
        }