Description
The method Bitmap.RotateFlip (RotateFlipType) in library System.Drawing does not what is expected.
The effect can be demonstrated with a sample program as follows:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace WindowsFormsApplication1
{
static class Program
{
[STAThread]
static void Main ( )
{
Bitmap bmp = new Bitmap ( 400, 200 );
Graphics g = Graphics.FromImage ( bmp );
g.DrawRectangle ( Pens.Orange, 0, 0, 399, 199 );
g.DrawLine ( Pens.Blue, 0, 0, 399, 199 );
g.DrawLine ( Pens.Blue, 0, 199, 399, 0 );
bmp.Save ( Environment.GetFolderPath ( Environment.SpecialFolder.MyPictures ) + Path.DirectorySeparatorChar + "Normal.BMP", ImageFormat.Bmp );
bmp.RotateFlip ( RotateFlipType.Rotate90FlipNone );
bmp.Save ( Environment.GetFolderPath ( Environment.SpecialFolder.MyPictures ) + Path.DirectorySeparatorChar + "Rotated.BMP", ImageFormat.Bmp );
}
}
}
Steps to reproduce:
Execute the sample program (see also exe-File in attached zip) on a Windows system i.e. with the original .NET and look, with any picture viewer program, at the new files "Normal.BMP" and "Rotated.BMP" in the personal picture folder.
Do the same on a linux system running Mono.
Compare the files produced by the sample program.
Expected behaviour:
The two files created by the sample program should show the same content, just one (namely "Rotated.BMP") rotated by 90 degrees.
Current Behaviour:
When executed with Mono on Linux (my system has version 6.4.0.198), the content of the file "Rotated.BMP" is wrong. Therefore method Bitmap.RotateFlip (RotateFlipType) contains some bug.