diff --git a/src/Greenshot.Base/Core/ImageHelper.cs b/src/Greenshot.Base/Core/ImageHelper.cs index 28dbe8a80..ea498cf7d 100644 --- a/src/Greenshot.Base/Core/ImageHelper.cs +++ b/src/Greenshot.Base/Core/ImageHelper.cs @@ -1824,5 +1824,27 @@ namespace Greenshot.Base.Core return bitmap; } + + /// + /// Rotate the image + /// + /// Input image + /// Angle in degrees + /// Rotated image + public static Image Rotate(this Image image, float rotationAngle) + { + var bitmap = new Bitmap(image.Width, image.Height); + + using var gfx = Graphics.FromImage(bitmap); + gfx.InterpolationMode = InterpolationMode.HighQualityBicubic; + + gfx.TranslateTransform((float)bitmap.Width / 2, (float)bitmap.Height / 2); + gfx.RotateTransform(rotationAngle); + gfx.TranslateTransform(-(float)bitmap.Width / 2, -(float)bitmap.Height / 2); + + gfx.DrawImage(image, new Point(0, 0)); + + return bitmap; + } } } \ No newline at end of file diff --git a/src/Greenshot.Editor/Drawing/EmojiContainer.cs b/src/Greenshot.Editor/Drawing/EmojiContainer.cs index bbfdf1990..6cb356271 100644 --- a/src/Greenshot.Editor/Drawing/EmojiContainer.cs +++ b/src/Greenshot.Editor/Drawing/EmojiContainer.cs @@ -207,7 +207,15 @@ namespace Greenshot.Editor.Drawing private Image ComputeBitmap(int iconSize) { - return EmojiRenderer.GetBitmap(Emoji, iconSize); + var image = EmojiRenderer.GetBitmap(Emoji, iconSize); + if (_rotationAngle != 0) + { + var newImage = image.Rotate(_rotationAngle); + image.Dispose(); + return newImage; + } + + return image; } private void ResetCachedBitmap()