Reputation: 485
I am trying to rotate a monochrome Bitmap in GDI+ using RotateFlip method. When i try to rotate it by 90/270 I get a wrong image or the application crashes. But when I try to rotate it by 180 degrees it works fine. Hence I am now rotating all monochrome bitmaps twice through 180 and then rotating it again by the angle required.
Is this a known bug in GDI+? Any other good workarounds would be appreciated.
Upvotes: 0
Views: 682
Reputation: 680
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Matrix m = new Matrix();
Bitmap bmp = new Bitmap("myfile");
m.Rotate(30);
e.Graphics.Transform = m;
e.Graphics.DrawImageUnscaled(bmp);
Upvotes: 2
Reputation: 99605
Looks like a known bug in GDI+: connect.microsoft.com/.../image-rotateflip-works-incorrectly-with-certain-images
Upvotes: 0