Exemplo n.º 1
0
        public Bitmap Apply(Bitmap sourceBitmap, Matrix matrix)
        {
            RotateFlipType flipType;

            if (Angle == 90)
            {
                matrix.Rotate(90, MatrixOrder.Append);
                matrix.Translate(sourceBitmap.Height, 0, MatrixOrder.Append);
                flipType = RotateFlipType.Rotate90FlipNone;
            }
            else if (Angle == -90 || Angle == 270)
            {
                flipType = RotateFlipType.Rotate270FlipNone;
                matrix.Rotate(-90, MatrixOrder.Append);
                matrix.Translate(0, sourceBitmap.Width, MatrixOrder.Append);
            }
            else
            {
                throw new NotSupportedException("Currently only an angle of 90 or -90 (270) is supported.");
            }
            return(sourceBitmap.ApplyRotateFlip(flipType));
        }