Forum Libraries, Components, and Plugins

Rotate a bitmap with good quality


I am using the following method to rotate a SKBitmap by a certain number of degrees.

        SKBitmap RotateBitmap(SKBitmap bitmap, int degrees)
            var rotated = new SKBitmap(bitmap.Width, bitmap.Height);

            var surface = new SKCanvas(rotated);

            surface.Translate(rotated.Width / 2, rotated.Height / 2);
            surface.Translate(-rotated.Width / 2, -rotated.Height / 2);
            surface.DrawBitmap(bitmap, 0, 0);

            return rotated;

If the degrees are different from 90, 180 and 270 the resulting bitmap has steps at edges (as if anti aliasing is deactivated)
Can somebody tell a way that I end up with a rotated bitmap at good quality?


Sign In or Register to comment.