|
|
|
@ -83,7 +83,7 @@ namespace ImageProcessor.Processors |
|
|
|
/// <param name="angle">The angle in degrees at which to rotate the image.</param>
|
|
|
|
/// <returns>The image rotated to the given angle at the given position.</returns>
|
|
|
|
/// <remarks>
|
|
|
|
/// Based on <see cref="T:ImageProcessor.Processors.Rotate"/>
|
|
|
|
/// Based on the Rotate effect
|
|
|
|
/// </remarks>
|
|
|
|
private Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle) |
|
|
|
{ |
|
|
|
@ -91,6 +91,8 @@ namespace ImageProcessor.Processors |
|
|
|
Bitmap newImage = new Bitmap(image.Width, image.Height); |
|
|
|
newImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); |
|
|
|
|
|
|
|
float zoom = Imaging.Rotation.ZoomAfterRotation(image.Width, image.Height, angle); |
|
|
|
|
|
|
|
// Make a graphics object from the empty bitmap
|
|
|
|
using (Graphics graphics = Graphics.FromImage(newImage)) |
|
|
|
{ |
|
|
|
@ -106,6 +108,9 @@ namespace ImageProcessor.Processors |
|
|
|
// Rotate the image
|
|
|
|
graphics.RotateTransform(angle); |
|
|
|
|
|
|
|
// Zooms the image to fit the area
|
|
|
|
graphics.ScaleTransform(zoom, zoom); |
|
|
|
|
|
|
|
// Move the image back
|
|
|
|
graphics.TranslateTransform(-rotateAtX * 2, -rotateAtY * 2); |
|
|
|
|
|
|
|
|