Browse Source

Fixes the rotation calculations

Former-commit-id: a8b3a255e6f4881e02b0fcc3aa9c1e22d84fd014
Former-commit-id: 7d263535078966c8773e28278d61913aeca166d9
pull/17/head
Thomas Broust 11 years ago
parent
commit
423e602dc7
  1. 6
      src/ImageProcessor/Processors/RotateInside.cs

6
src/ImageProcessor/Processors/RotateInside.cs

@ -134,16 +134,16 @@ namespace ImageProcessor.Processors
int diffY = (image.Height - newSize.Height) / 2;
// Put the rotation point in the "center" of the old image
graphics.TranslateTransform(diffX, diffY);
graphics.TranslateTransform(rotateAtX - diffX, rotateAtY - diffY);
// Rotate the image
graphics.RotateTransform(rotateLayer.Angle);
// Move the image back
graphics.TranslateTransform(-diffX * 2, -diffY * 2);
graphics.TranslateTransform(-(rotateAtX - diffX), -(rotateAtY - diffY));
// Draw passed in image onto graphics object
graphics.DrawImage(image, new PointF(0, 0));
graphics.DrawImage(image, new PointF(-diffX, -diffY));
}
}

Loading…
Cancel
Save